diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 2e1c5f0fdb..0b842305ae 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -15,7 +15,7 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': workspace:1.3.2 + '@visactor/vchart': workspace:1.3.3 '@visactor/vgrammar': ~0.6.6 '@visactor/vmind': 1.0.6-alpha.1 '@visactor/vrender': ~0.14.8 @@ -56,7 +56,7 @@ importers: '@internal/eslint-config': link:../share/eslint-config '@internal/story-player': link:../tools/story-player '@internal/ts-config': link:../share/ts-config - '@types/highlightjs': 9.12.2 + '@types/highlightjs': 9.12.3 '@types/markdown-it': 13.0.1 '@types/react': 18.2.21 '@types/react-dom': 18.2.7 @@ -121,7 +121,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.3.2 + '@visactor/vchart': workspace:1.3.3 '@visactor/vgrammar': ~0.6.6 '@visactor/vrender': ~0.14.8 '@visactor/vutils': ~0.15.14 @@ -154,7 +154,7 @@ importers: '@rollup/plugin-typescript': 11.1.0_3riap2emcx3rezd3j6fqob2ipq '@rushstack/eslint-patch': 1.1.4 '@types/jest': 26.0.24 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/offscreencanvas': 2019.6.4 '@types/react': 18.2.21 '@types/react-dom': 18.2.7 @@ -173,7 +173,7 @@ importers: ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai tslib: 2.3.1 typescript: 4.9.5 - vite: 3.2.6_@types+node@20.6.1 + vite: 3.2.6_@types+node@20.6.2 ../../packages/taro-vchart: specifiers: @@ -201,7 +201,7 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.3.2 + '@visactor/vchart': workspace:1.3.3 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 @@ -338,7 +338,7 @@ importers: '@internal/typescript-json-schema': link:../../tools/typescript-json-schema '@rushstack/eslint-patch': 1.1.4 '@types/jest': 26.0.24 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/offscreencanvas': 2019.6.4 canvas: 2.11.2 d3-array: 3.2.3 @@ -364,11 +364,11 @@ importers: rollup-plugin-visualizer: 5.9.2_rollup@3.20.5 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 8.0.2_typescript@4.9.5 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy tslib: 2.3.1 tslint: 5.12.1_typescript@4.9.5 typescript: 4.9.5 - vite: 3.2.6_@types+node@20.6.1 + vite: 3.2.6_@types+node@20.6.2 ../../packages/vchart-editor: specifiers: @@ -379,7 +379,7 @@ importers: '@types/jest': ^26.0.0 '@types/node': '*' '@types/offscreencanvas': 2019.6.4 - '@visactor/vchart': workspace:1.3.2 + '@visactor/vchart': workspace:1.3.3 '@visactor/vdataset': ~0.15.14 '@visactor/vrender': ~0.14.8 '@visactor/vutils': ~0.15.14 @@ -409,7 +409,7 @@ importers: '@internal/ts-config': link:../../share/ts-config '@rushstack/eslint-patch': 1.1.4 '@types/jest': 26.0.24 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/offscreencanvas': 2019.6.4 eslint: 8.18.0 husky: 7.0.4 @@ -421,11 +421,11 @@ importers: react-device-detect: 2.2.3 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai ts-loader: 8.0.2_typescript@4.9.5 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy tslib: 2.3.1 tslint: 5.12.1_typescript@4.9.5 typescript: 4.9.5 - vite: 3.2.6_@types+node@20.6.1 + vite: 3.2.6_@types+node@20.6.2 ../../packages/vchart-schema: specifiers: @@ -612,7 +612,7 @@ importers: '@types/merge2': 1.4.0 '@types/minimist': 1.2.2 '@types/ms': 0.7.31 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/semver': 7.3.12 '@types/terser': 3.12.0 '@types/through2': 2.0.38 @@ -620,7 +620,7 @@ importers: '@types/vinyl': 2.0.7 '@types/yargs-parser': 21.0.0 eslint: 8.18.0 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy typescript: 4.9.5 vitest: 0.30.1_less@4.1.3+terser@5.17.1 @@ -634,7 +634,7 @@ importers: '@types/node': '*' '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.3.2 + '@visactor/vchart': workspace:1.3.3 '@visactor/vrender': ~0.14.8 '@visactor/vutils': ~0.15.14 cross-env: ^7.0.3 @@ -656,7 +656,7 @@ importers: '@internal/ts-config': link:../../share/ts-config '@rushstack/eslint-patch': 1.1.4 '@types/jest': 26.0.24 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@typescript-eslint/eslint-plugin': 5.30.0_cow5zg7tx6c3eisi5a4ud5kwia '@typescript-eslint/parser': 5.30.0_vwud3sodsb5zxmzckoj7rdwdbq cross-env: 7.0.3 @@ -664,10 +664,10 @@ importers: jest: 26.6.3_ts-node@10.9.0 prettier: 2.6.1 ts-jest: 26.5.6_xuote2qreek47x2di7kesslrai - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy tslint-config-prettier: 1.18.0 typescript: 4.9.5 - vite: 3.2.6_@types+node@20.6.1 + vite: 3.2.6_@types+node@20.6.2 ../../tools/typescript-json-schema: specifiers: @@ -688,12 +688,12 @@ importers: typescript: 4.9.5 yargs: ^17.1.1 dependencies: - '@types/json-schema': 7.0.12 - '@types/node': 20.6.1 + '@types/json-schema': 7.0.13 + '@types/node': 20.6.2 glob: 7.2.3 path-equal: 1.2.5 safe-stable-stringify: 2.4.3 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy typescript: 4.9.5 yargs: 17.7.2 devDependencies: @@ -760,11 +760,11 @@ packages: resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} engines: {node: '>=6.9.0'} dependencies: - '@babel/highlight': 7.22.13 + '@babel/highlight': 7.22.20 chalk: 2.4.2 - /@babel/compat-data/7.22.9: - resolution: {integrity: sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==} + /@babel/compat-data/7.22.20: + resolution: {integrity: sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw==} engines: {node: '>=6.9.0'} /@babel/core/7.20.12: @@ -775,11 +775,11 @@ packages: '@babel/code-frame': 7.22.13 '@babel/generator': 7.21.1 '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-module-transforms': 7.22.19_@babel+core@7.20.12 + '@babel/helper-module-transforms': 7.22.20_@babel+core@7.20.12 '@babel/helpers': 7.22.15 '@babel/parser': 7.22.16 '@babel/template': 7.22.15 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 convert-source-map: 1.9.0 debug: 4.3.4 @@ -833,7 +833,7 @@ packages: resolution: {integrity: sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/compat-data': 7.22.9 + '@babel/compat-data': 7.22.20 '@babel/helper-validator-option': 7.22.15 browserslist: 4.21.10 lru-cache: 5.1.1 @@ -847,11 +847,11 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.22.5 '@babel/helper-member-expression-to-functions': 7.22.15 '@babel/helper-optimise-call-expression': 7.22.5 - '@babel/helper-replace-supers': 7.22.9_@babel+core@7.20.12 + '@babel/helper-replace-supers': 7.22.20_@babel+core@7.20.12 '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 semver: 6.3.1 @@ -877,13 +877,13 @@ packages: '@babel/helper-plugin-utils': 7.22.5 debug: 4.3.4 lodash.debounce: 4.0.8 - resolve: 1.22.5 + resolve: 1.22.6 semver: 6.3.1 transitivePeerDependencies: - supports-color - /@babel/helper-environment-visitor/7.22.5: - resolution: {integrity: sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==} + /@babel/helper-environment-visitor/7.22.20: + resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} engines: {node: '>=6.9.0'} /@babel/helper-function-name/7.0.0-beta.44: @@ -925,18 +925,18 @@ packages: dependencies: '@babel/types': 7.22.19 - /@babel/helper-module-transforms/7.22.19_@babel+core@7.20.12: - resolution: {integrity: sha512-m6h1cJvn+OJ+R3jOHp30faq5xKJ7VbjwDj5RGgHuRlU9hrMeKsGC+JpihkR5w1g7IfseCPPtZ0r7/hB4UKaYlA==} + /@babel/helper-module-transforms/7.22.20_@babel+core@7.20.12: + resolution: {integrity: sha512-dLT7JVWIUUxKOs1UnJUBR3S70YK+pKX6AbJgB2vMIvEkZkrfJDbYDJesnPshtKV4LhDOR3Oc5YULeDizRek+5A==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-module-imports': 7.22.15 '@babel/helper-simple-access': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 - '@babel/helper-validator-identifier': 7.22.19 + '@babel/helper-validator-identifier': 7.22.20 /@babel/helper-optimise-call-expression/7.22.5: resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} @@ -948,25 +948,25 @@ packages: resolution: {integrity: sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==} engines: {node: '>=6.9.0'} - /@babel/helper-remap-async-to-generator/7.22.17_@babel+core@7.20.12: - resolution: {integrity: sha512-bxH77R5gjH3Nkde6/LuncQoLaP16THYPscurp1S8z7S9ZgezCyV3G8Hc+TZiCmY8pz4fp8CvKSgtJMW0FkLAxA==} + /@babel/helper-remap-async-to-generator/7.22.20_@babel+core@7.20.12: + resolution: {integrity: sha512-pBGyV4uBqOns+0UvhsTO8qgl8hO89PmiDYv+/COyp1aeMcmfrfruz+/nCMFiYyFF/Knn0yfrC85ZzNFjembFTw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.20.12 '@babel/helper-annotate-as-pure': 7.22.5 - '@babel/helper-environment-visitor': 7.22.5 - '@babel/helper-wrap-function': 7.22.17 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-wrap-function': 7.22.20 - /@babel/helper-replace-supers/7.22.9_@babel+core@7.20.12: - resolution: {integrity: sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==} + /@babel/helper-replace-supers/7.22.20_@babel+core@7.20.12: + resolution: {integrity: sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-member-expression-to-functions': 7.22.15 '@babel/helper-optimise-call-expression': 7.22.5 @@ -998,16 +998,16 @@ packages: resolution: {integrity: sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==} engines: {node: '>=6.9.0'} - /@babel/helper-validator-identifier/7.22.19: - resolution: {integrity: sha512-Tinq7ybnEPFFXhlYOYFiSjespWQk0dq2dRNAiMdRTOYQzEGqnnNyrTxPYHP5r6wGjlF1rFgABdDV0g8EwD6Qbg==} + /@babel/helper-validator-identifier/7.22.20: + resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} /@babel/helper-validator-option/7.22.15: resolution: {integrity: sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==} engines: {node: '>=6.9.0'} - /@babel/helper-wrap-function/7.22.17: - resolution: {integrity: sha512-nAhoheCMlrqU41tAojw9GpVEKDlTS8r3lzFmF0lP52LwblCPbuFSO7nGIZoIcoU5NIm1ABrna0cJExE4Ay6l2Q==} + /@babel/helper-wrap-function/7.22.20: + resolution: {integrity: sha512-pms/UwkOpnQe/PDAEdV/d7dVCoBbB+R4FvYoHGZz+4VPcg7RtYy2KP7S2lbuWM6FCSgob5wshfGESbC/hzNXZw==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-function-name': 7.22.5 @@ -1019,7 +1019,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.22.15 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 transitivePeerDependencies: - supports-color @@ -1032,11 +1032,11 @@ packages: js-tokens: 3.0.2 dev: true - /@babel/highlight/7.22.13: - resolution: {integrity: sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ==} + /@babel/highlight/7.22.20: + resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/helper-validator-identifier': 7.22.19 + '@babel/helper-validator-identifier': 7.22.20 chalk: 2.4.2 js-tokens: 4.0.0 @@ -1073,9 +1073,9 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-remap-async-to-generator': 7.22.17_@babel+core@7.20.12 + '@babel/helper-remap-async-to-generator': 7.22.20_@babel+core@7.20.12 '@babel/plugin-syntax-async-generators': 7.8.4_@babel+core@7.20.12 /@babel/plugin-proposal-class-properties/7.10.4_@babel+core@7.20.12: @@ -1206,7 +1206,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/compat-data': 7.22.9 + '@babel/compat-data': 7.22.20 '@babel/core': 7.20.12 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 @@ -1221,7 +1221,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/compat-data': 7.22.9 + '@babel/compat-data': 7.22.20 '@babel/core': 7.20.12 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 @@ -1493,7 +1493,7 @@ packages: '@babel/core': 7.20.12 '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-remap-async-to-generator': 7.22.17_@babel+core@7.20.12 + '@babel/helper-remap-async-to-generator': 7.22.20_@babel+core@7.20.12 /@babel/plugin-transform-block-scoped-functions/7.22.5_@babel+core@7.20.12: resolution: {integrity: sha512-tdXZ2UdknEKQWKJP1KMNmuF5Lx3MymtMN/pvA+p/VEkhK8jVcQ1fzSy8KM9qRYhAf2/lV33hoMPKI/xaI9sADA==} @@ -1522,11 +1522,11 @@ packages: '@babel/core': 7.20.12 '@babel/helper-annotate-as-pure': 7.22.5 '@babel/helper-compilation-targets': 7.22.15 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.22.5 '@babel/helper-optimise-call-expression': 7.22.5 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-replace-supers': 7.22.9_@babel+core@7.20.12 + '@babel/helper-replace-supers': 7.22.20_@babel+core@7.20.12 '@babel/helper-split-export-declaration': 7.22.6 globals: 11.12.0 @@ -1634,7 +1634,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-module-transforms': 7.22.19_@babel+core@7.20.12 + '@babel/helper-module-transforms': 7.22.20_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 /@babel/plugin-transform-modules-commonjs/7.22.15_@babel+core@7.20.12: @@ -1644,7 +1644,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-module-transforms': 7.22.19_@babel+core@7.20.12 + '@babel/helper-module-transforms': 7.22.20_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 '@babel/helper-simple-access': 7.22.5 @@ -1656,9 +1656,9 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-hoist-variables': 7.22.5 - '@babel/helper-module-transforms': 7.22.19_@babel+core@7.20.12 + '@babel/helper-module-transforms': 7.22.20_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-validator-identifier': 7.22.19 + '@babel/helper-validator-identifier': 7.22.20 /@babel/plugin-transform-modules-umd/7.22.5_@babel+core@7.20.12: resolution: {integrity: sha512-+S6kzefN/E1vkSsKx8kmQuqeQsvCKCd1fraCM7zXm4SFoggI099Tr4G8U81+5gtMdUeMQ4ipdQffbKLX0/7dBQ==} @@ -1667,7 +1667,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.20.12 - '@babel/helper-module-transforms': 7.22.19_@babel+core@7.20.12 + '@babel/helper-module-transforms': 7.22.20_@babel+core@7.20.12 '@babel/helper-plugin-utils': 7.22.5 /@babel/plugin-transform-named-capturing-groups-regex/7.22.5_@babel+core@7.20.12: @@ -1707,7 +1707,7 @@ packages: dependencies: '@babel/core': 7.20.12 '@babel/helper-plugin-utils': 7.22.5 - '@babel/helper-replace-supers': 7.22.9_@babel+core@7.20.12 + '@babel/helper-replace-supers': 7.22.20_@babel+core@7.20.12 /@babel/plugin-transform-optional-chaining/7.22.15_@babel+core@7.20.12: resolution: {integrity: sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A==} @@ -1826,7 +1826,7 @@ packages: '@babel/core': 7.20.12 '@babel/helper-module-imports': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 - resolve: 1.22.5 + resolve: 1.22.6 semver: 5.7.2 dev: true @@ -1913,7 +1913,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/compat-data': 7.22.9 + '@babel/compat-data': 7.22.20 '@babel/core': 7.20.12 '@babel/helper-compilation-targets': 7.22.15 '@babel/helper-plugin-utils': 7.22.5 @@ -2125,13 +2125,13 @@ packages: lodash: 4.17.21 dev: true - /@babel/traverse/7.22.19: - resolution: {integrity: sha512-ZCcpVPK64krfdScRbpxF6xA5fz7IOsfMwx1tcACvCzt6JY+0aHkBk7eIU8FRDSZRU5Zei6Z4JfgAxN1bqXGECg==} + /@babel/traverse/7.22.20: + resolution: {integrity: sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==} engines: {node: '>=6.9.0'} dependencies: '@babel/code-frame': 7.22.13 '@babel/generator': 7.22.15 - '@babel/helper-environment-visitor': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-function-name': 7.22.5 '@babel/helper-hoist-variables': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 @@ -2155,7 +2155,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/helper-string-parser': 7.22.5 - '@babel/helper-validator-identifier': 7.22.19 + '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 /@bcoe/v8-coverage/0.2.3: @@ -2247,7 +2247,7 @@ packages: /@fast-csv/format/4.3.5: resolution: {integrity: sha512-8iRn6QF3I8Ak78lNAa+Gdl5MJJBM5vRHivFtMRUWINdevNo00K7OXxS2PshawLKTejVwieIlPmK5YlLu6w4u8A==} dependencies: - '@types/node': 14.18.60 + '@types/node': 14.18.61 lodash.escaperegexp: 4.1.2 lodash.isboolean: 3.0.3 lodash.isequal: 4.5.0 @@ -2258,7 +2258,7 @@ packages: /@fast-csv/parse/4.3.6: resolution: {integrity: sha512-uRsLYksqpbDmWaSmzvJcuApSEe38+6NQZBUsuAyMZKqHxH0g1wcJgsKUvN3WC8tewaqFjBMMGrkHmC+T7k8LvA==} dependencies: - '@types/node': 14.18.60 + '@types/node': 14.18.61 lodash.escaperegexp: 4.1.2 lodash.groupby: 4.6.0 lodash.isfunction: 3.0.9 @@ -2386,7 +2386,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 jest-message-util: 26.6.2 jest-util: 26.6.2 @@ -2402,7 +2402,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -2442,7 +2442,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -2482,7 +2482,7 @@ packages: '@jest/test-result': 26.6.2 '@jest/transform': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 ansi-escapes: 4.3.2 chalk: 4.1.2 exit: 0.1.2 @@ -2531,7 +2531,7 @@ packages: dependencies: '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 jest-mock: 26.6.2 dev: true @@ -2550,7 +2550,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@sinonjs/fake-timers': 6.0.1 - '@types/node': 20.6.1 + '@types/node': 20.6.2 jest-message-util: 26.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 @@ -2761,7 +2761,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/yargs': 15.0.15 chalk: 4.1.2 dev: true @@ -2998,7 +2998,7 @@ packages: deepmerge: 4.3.1 is-builtin-module: 3.2.1 is-module: 1.0.0 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 3.20.5 /@rollup/plugin-replace/5.0.2_rollup@3.20.5: @@ -3044,7 +3044,7 @@ packages: optional: true dependencies: '@rollup/pluginutils': 5.0.4_rollup@3.20.5 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 3.20.5 tslib: 2.3.1 typescript: 4.9.5 @@ -3064,7 +3064,7 @@ packages: optional: true dependencies: '@rollup/pluginutils': 5.0.4_rollup@3.20.5 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 3.20.5 typescript: 4.9.5 dev: false @@ -3083,7 +3083,7 @@ packages: optional: true dependencies: '@rollup/pluginutils': 5.0.4_rollup@3.20.5 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 3.20.5 dev: true @@ -3265,7 +3265,7 @@ packages: prettier: 1.19.1 prop-types: 15.8.1 request: 2.88.2 - resolve: 1.22.5 + resolve: 1.22.6 sax: 1.2.4 semver: 5.7.2 shelljs: 0.8.5 @@ -3365,7 +3365,7 @@ packages: postcss-url: 8.0.0 regenerator-runtime: 0.11.1 request: 2.88.2 - resolve: 1.22.5 + resolve: 1.22.6 resolve-url-loader: 4.0.0 sass: 1.32.11 sass-loader: 10.2.0_plgffpjwzsa5bvy6a5mx2v5i5m @@ -3741,23 +3741,23 @@ packages: dependencies: '@babel/parser': 7.22.16 '@babel/types': 7.22.19 - '@types/babel__generator': 7.6.4 - '@types/babel__template': 7.4.1 - '@types/babel__traverse': 7.20.1 + '@types/babel__generator': 7.6.5 + '@types/babel__template': 7.4.2 + '@types/babel__traverse': 7.20.2 - /@types/babel__generator/7.6.4: - resolution: {integrity: sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==} + /@types/babel__generator/7.6.5: + resolution: {integrity: sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w==} dependencies: '@babel/types': 7.22.19 - /@types/babel__template/7.4.1: - resolution: {integrity: sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==} + /@types/babel__template/7.4.2: + resolution: {integrity: sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ==} dependencies: '@babel/parser': 7.22.16 '@babel/types': 7.22.19 - /@types/babel__traverse/7.20.1: - resolution: {integrity: sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==} + /@types/babel__traverse/7.20.2: + resolution: {integrity: sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw==} dependencies: '@babel/types': 7.22.19 @@ -3778,7 +3778,7 @@ packages: /@types/clean-css/4.2.6: resolution: {integrity: sha512-Ze1tf+LnGPmG6hBFMi0B4TEB0mhF7EiMM5oyjLDNPE9hxrPU0W+5+bHvO+eFPA+bt0iC1zkQMoU/iGdRVjcRbw==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 source-map: 0.6.1 dev: true @@ -3797,19 +3797,19 @@ packages: /@types/fs-extra/8.1.3: resolution: {integrity: sha512-7IdV01N0u/CaVO0fuY1YmEg14HQN3+EW8mpNgg6NEfxEl/lzCa5OxlBu3iFsCAdamnYOcTQ7oEi43Xc/67Rgzw==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/glob-stream/8.0.0: resolution: {integrity: sha512-fxTWwdQmX9LWSHD7ZLlv3BHR992mKcVcDnT/2v+l/QZZo7TfDdyasqlSYVzOnMGWhRbrWeWkbj/mgezFjKynhw==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/picomatch': 2.3.0 '@types/streamx': 2.9.1 dev: true @@ -3817,26 +3817,26 @@ packages: /@types/glob-watcher/5.0.2: resolution: {integrity: sha512-MZeh2nIzibl/euv5UV0femkGzcKTSE4G2+zv48d6ymeitWwCx52+4X+FqzML9oH2mQnPs+N/JHp3CsBPj1x1Ug==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/glob/7.2.0: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/graceful-fs/4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/gulp-if/0.0.34: resolution: {integrity: sha512-r2A04hHDC+ZWMRAm+3q6/UeC3ggvl+TZm9P1+2umnp4q9bOlBmUQnR178Io3c0DkZPQAwup8VNtOvmvaWCpP5w==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/vinyl': 2.0.7 dev: true @@ -3850,7 +3850,7 @@ packages: /@types/gulp-sourcemaps/0.0.35: resolution: {integrity: sha512-vUBuizwA4CAV3Mke0DJYHQxyN4YOB1aAql284qAO7Et7fe0hmnPi/R9Fhu2UhxMuSxAwFktsJUOQk5dJHOU1eA==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/vinyl': 2.0.7 dev: true @@ -3862,8 +3862,8 @@ packages: chokidar: 3.5.3 dev: true - /@types/highlightjs/9.12.2: - resolution: {integrity: sha512-oW2pEKwshxwBW1nVUizWQg/tnhboRtKrUKnF2hd6l4BZ0shr5ZjQ4ra/82+NEH6uWeM8JjrMGCux5enQXOQbTA==} + /@types/highlightjs/9.12.3: + resolution: {integrity: sha512-ChFypzReLIfafoMl8oOAAfzTdACc1LWs+gECvqnMQibjwaVAHNgQ+ai3yDCHORO8Vxi+3NcUUHTox7XO/Ed4zw==} dev: true /@types/istanbul-lib-coverage/2.0.4: @@ -3896,8 +3896,8 @@ packages: pretty-format: 26.6.2 dev: true - /@types/json-schema/7.0.12: - resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} + /@types/json-schema/7.0.13: + resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==} /@types/json5/0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} @@ -3941,7 +3941,7 @@ packages: /@types/merge2/1.4.0: resolution: {integrity: sha512-MRHDvln2ldZELrUC8n1PGaQzZ33aNh8uDcsGehREW0zR1Fr818a4/JTZjO9eloHPPxnpUp8fz/YFTRc5CWm7Xw==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/minimatch/3.0.5: @@ -3968,16 +3968,16 @@ packages: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} dev: true - /@types/node/14.18.60: - resolution: {integrity: sha512-F2dfYDznasZ6XfuWvTmQcrElTHfxCdC+F23WCcuAJaIrMIhhBUSARJQdy0lUY+MPDNLqGvTo8/IuiF+QX64IHQ==} + /@types/node/14.18.61: + resolution: {integrity: sha512-1mFT4DqS4/s9tlZbdkwEB/EnSykA9MDeDLIk3FHApGvIMGY//qgstB2gu9GKGESWyW/qiRUO+jhlLJ9bBJ8j+Q==} dev: false /@types/node/15.14.9: resolution: {integrity: sha512-qjd88DrCxupx/kJD5yQgZdcYKZKSIGBVDIBE1/LTGcNm3d2Np/jxojkdePDdfnBHJc5W7vSMpbJ1aB7p/Py69A==} dev: true - /@types/node/20.6.1: - resolution: {integrity: sha512-4LcJvuXQlv4lTHnxwyHQZ3uR9Zw2j7m1C9DfuwoTFQQP4Pmu04O6IfLYgMmHoOCt0nosItLLZAH+sOrRE0Bo8g==} + /@types/node/20.6.2: + resolution: {integrity: sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==} /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -4033,7 +4033,7 @@ packages: resolution: {integrity: sha512-whjk1EDJPcAR2kYHRbFl/lKeeKYTi05A15K9bnLInCVroNDCtXce57xKdI0/rQaA3K+6q0eFyUBPmqfSndUZdQ==} dependencies: '@types/caseless': 0.12.3 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/tough-cookie': 4.0.3 form-data: 2.5.1 dev: true @@ -4066,7 +4066,7 @@ packages: /@types/streamx/2.9.1: resolution: {integrity: sha512-9bywzhouyedmci7WCIPFwJ8zASDnxt2gaVUy52X0p0Tt085IJSAEP0L6j4SSNeDMSLzpYu6cPz0GrJZ7kPJ6Bg==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/terser/3.12.0: @@ -4079,7 +4079,7 @@ packages: /@types/through2/2.0.38: resolution: {integrity: sha512-YFu+nHmjxMurkH1BSzA0Z1WrKDAY8jUKPZctNQn7mc+/KKtp2XxnclHFXxdB1m7Iqnzb5aywgP8TMK283LezGQ==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /@types/tough-cookie/4.0.3: @@ -4093,7 +4093,7 @@ packages: /@types/undertaker/1.2.8: resolution: {integrity: sha512-gW3PRqCHYpo45XFQHJBhch7L6hytPsIe0QeLujlnFsjHPnXLhJcPdN6a9368d7aIQgH2I/dUTPFBlGeSNA3qOg==} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/undertaker-registry': 1.0.2 async-done: 1.3.2 dev: true @@ -4106,7 +4106,7 @@ packages: resolution: {integrity: sha512-ctNcmmzbMIKooXjRkyyUCOu2Z4AyqibL+RhXoF3pb7K7j+ezItnakmpm31LymkYHSIM5ey0tjIFzTvFOTSBCGw==} dependencies: '@types/glob-stream': 8.0.0 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/vinyl': 2.0.7 dev: true @@ -4114,7 +4114,7 @@ packages: resolution: {integrity: sha512-4UqPv+2567NhMQuMLdKAyK4yzrfCqwaTt6bLhHEs8PFcxbHILsrxaY63n4wgE/BRLDWDQeI+WcTmkXKExh9hQg==} dependencies: '@types/expect': 1.20.4 - '@types/node': 20.6.1 + '@types/node': 20.6.2 /@types/webpack-env/1.18.1: resolution: {integrity: sha512-D0HJET2/UY6k9L6y3f5BL+IDxZmPkYmPT4+qBrRdmRLYRuV0qNKizMgTvYxXZYn+36zjPeoDZAEYBCM6XB+gww==} @@ -4310,7 +4310,7 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.13 '@typescript-eslint/scope-manager': 5.30.0 '@typescript-eslint/types': 5.30.0 '@typescript-eslint/typescript-estree': 5.30.0_typescript@4.9.5 @@ -4554,7 +4554,7 @@ packages: '@babel/helper-module-imports': 7.22.15 '@babel/plugin-syntax-jsx': 7.22.5_@babel+core@7.20.12 '@babel/template': 7.22.15 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 '@vue/babel-helper-vue-transform-on': 1.1.5 camelcase: 6.3.0 @@ -5542,7 +5542,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.10 - caniuse-lite: 1.0.30001534 + caniuse-lite: 1.0.30001535 fraction.js: 4.3.6 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -5555,7 +5555,7 @@ packages: hasBin: true dependencies: browserslist: 3.2.8 - caniuse-lite: 1.0.30001534 + caniuse-lite: 1.0.30001535 normalize-range: 0.1.2 num2fraction: 1.2.2 postcss: 6.0.23 @@ -5568,7 +5568,7 @@ packages: hasBin: true dependencies: browserslist: 4.21.10 - caniuse-lite: 1.0.30001534 + caniuse-lite: 1.0.30001535 chalk: 2.4.2 normalize-range: 0.1.2 num2fraction: 1.2.2 @@ -5581,7 +5581,7 @@ packages: hasBin: true dependencies: browserslist: 4.21.10 - caniuse-lite: 1.0.30001534 + caniuse-lite: 1.0.30001535 normalize-range: 0.1.2 num2fraction: 1.2.2 picocolors: 0.2.1 @@ -5697,11 +5697,11 @@ packages: dependencies: '@babel/code-frame': 7.22.13 '@babel/parser': 7.22.16 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 eslint: 6.8.0 eslint-visitor-keys: 1.3.0 - resolve: 1.22.5 + resolve: 1.22.6 transitivePeerDependencies: - supports-color dev: true @@ -5715,11 +5715,11 @@ packages: dependencies: '@babel/code-frame': 7.22.13 '@babel/parser': 7.22.16 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 eslint: 8.18.0 eslint-visitor-keys: 1.3.0 - resolve: 1.22.5 + resolve: 1.22.6 transitivePeerDependencies: - supports-color dev: true @@ -5901,7 +5901,7 @@ packages: resolution: {integrity: sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw==} engines: {node: '>= 6'} dependencies: - '@types/babel__traverse': 7.20.1 + '@types/babel__traverse': 7.20.2 dev: true /babel-plugin-jest-hoist/26.6.2: @@ -5911,7 +5911,7 @@ packages: '@babel/template': 7.22.15 '@babel/types': 7.22.19 '@types/babel__core': 7.20.0 - '@types/babel__traverse': 7.20.1 + '@types/babel__traverse': 7.20.2 dev: true /babel-plugin-jsx-attributes-array-to-object/0.3.0: @@ -5923,7 +5923,7 @@ packages: dependencies: '@babel/runtime': 7.17.0 cosmiconfig: 6.0.0 - resolve: 1.22.5 + resolve: 1.22.6 dev: true /babel-plugin-minify-dead-code/1.3.2: @@ -5937,7 +5937,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/compat-data': 7.22.9 + '@babel/compat-data': 7.22.20 '@babel/core': 7.20.12 '@babel/helper-define-polyfill-provider': 0.3.3_@babel+core@7.20.12 semver: 6.3.1 @@ -6526,8 +6526,8 @@ packages: resolution: {integrity: sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==} hasBin: true dependencies: - caniuse-lite: 1.0.30001534 - electron-to-chromium: 1.4.522 + caniuse-lite: 1.0.30001535 + electron-to-chromium: 1.4.523 dev: true /browserslist/4.21.10: @@ -6535,8 +6535,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001534 - electron-to-chromium: 1.4.522 + caniuse-lite: 1.0.30001535 + electron-to-chromium: 1.4.523 node-releases: 2.0.13 update-browserslist-db: 1.0.11_browserslist@4.21.10 @@ -6831,8 +6831,8 @@ packages: resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==} dev: true - /caniuse-lite/1.0.30001534: - resolution: {integrity: sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==} + /caniuse-lite/1.0.30001535: + resolution: {integrity: sha512-48jLyUkiWFfhm/afF7cQPqPjaUmSraEhK4j+FCTJpgnGGEZHqyLe3hmWH7lIooZdSzXL0ReMvHz0vKDoTBsrwg==} /canvas/2.11.2: resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} @@ -8394,7 +8394,7 @@ packages: hasBin: true dependencies: '@babel/parser': 7.22.16 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 builtin-modules: 3.3.0 deprecate: 1.1.1 deps-regex: 0.1.4 @@ -8404,7 +8404,7 @@ packages: node-sass-tilde-importer: 1.0.2 please-upgrade-node: 3.2.0 require-package-name: 2.0.1 - resolve: 1.22.5 + resolve: 1.22.6 vue-template-compiler: 2.7.14 walkdir: 0.3.2 yargs: 13.3.2 @@ -8774,8 +8774,8 @@ packages: jake: 10.8.7 dev: true - /electron-to-chromium/1.4.522: - resolution: {integrity: sha512-KGKjcafTpOxda0kqwQ72M0tDmX6RsGhUJTy0Hr7slt0+CgHh9Oex8JdjY9Og68dUkTLUlBOJC0A5W5Mw3QSGCg==} + /electron-to-chromium/1.4.523: + resolution: {integrity: sha512-9AreocSUWnzNtvLcbpng6N+GkXnCcBR80IQkxRC9Dfdyg4gaWNUPBujAHUpKkiUkoSoR9UlhA4zD/IgBklmhzg==} /electron/11.5.0: resolution: {integrity: sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==} @@ -9300,7 +9300,7 @@ packages: dependencies: debug: 3.2.7 is-core-module: 2.13.0 - resolve: 1.22.5 + resolve: 1.22.6 dev: true /eslint-module-utils/2.8.0_eslint@6.8.0: @@ -10540,7 +10540,7 @@ packages: resolution: {integrity: sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==} engines: {node: '>=12.0.0'} dependencies: - flatted: 3.2.7 + flatted: 3.2.9 keyv: 4.5.3 rimraf: 3.0.2 @@ -10553,8 +10553,8 @@ packages: resolution: {integrity: sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==} dev: true - /flatted/3.2.7: - resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} + /flatted/3.2.9: + resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} /flush-write-stream/1.1.1: resolution: {integrity: sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==} @@ -11394,7 +11394,7 @@ packages: resolution: {integrity: sha512-SVSF7ikuWKhpAW4l4wapAqPPSToJoiNKsbDoUnRrSgwZHH7lH8pbPeQj1aOVYQrbZKhfSVBxVW+Py7vtulRktw==} engines: {node: '>=10'} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@types/vinyl': 2.0.7 istextorbinary: 3.3.0 replacestream: 4.0.3 @@ -12781,7 +12781,7 @@ packages: '@babel/generator': 7.21.1 '@babel/parser': 7.22.16 '@babel/template': 7.22.15 - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@babel/types': 7.22.19 istanbul-lib-coverage: 2.0.5 semver: 6.3.1 @@ -13054,7 +13054,7 @@ packages: jest-validate: 26.6.2 micromatch: 4.0.5 pretty-format: 26.6.2 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy transitivePeerDependencies: - bufferutil - canvas @@ -13089,7 +13089,7 @@ packages: jest-validate: 26.6.2 micromatch: 4.0.5 pretty-format: 26.6.2 - ts-node: 10.9.0_hpm3aou6wkfm6xthbsdh7q76bm + ts-node: 10.9.0_3puo4rtspwl3idxgm5pkqjgczy transitivePeerDependencies: - bufferutil - canvas @@ -13159,7 +13159,7 @@ packages: jest: ^24.0.0 dependencies: electron: 11.5.0 - jest: 26.6.3 + jest: 26.6.3_xxvpynkn5i4ehycnunrxxsezu4 jest-haste-map: 24.9.0 jest-message-util: 24.9.0 jest-mock: 24.9.0 @@ -13194,7 +13194,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 jsdom: 16.7.0 @@ -13212,7 +13212,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 jsdom: 16.7.0_canvas@2.11.2 @@ -13243,7 +13243,7 @@ packages: '@jest/environment': 26.6.2 '@jest/fake-timers': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 jest-mock: 26.6.2 jest-util: 26.6.2 dev: true @@ -13283,7 +13283,7 @@ packages: dependencies: '@jest/types': 26.6.2 '@types/graceful-fs': 4.1.6 - '@types/node': 20.6.1 + '@types/node': 20.6.2 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -13302,7 +13302,7 @@ packages: resolution: {integrity: sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw==} engines: {node: '>= 6'} dependencies: - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@jest/environment': 24.9.0 '@jest/test-result': 24.9.0 '@jest/types': 24.9.0 @@ -13326,12 +13326,12 @@ packages: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@jest/environment': 26.6.2 '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -13356,12 +13356,12 @@ packages: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@jest/environment': 26.6.2 '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -13386,12 +13386,12 @@ packages: resolution: {integrity: sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==} engines: {node: '>= 10.14.2'} dependencies: - '@babel/traverse': 7.22.19 + '@babel/traverse': 7.22.20 '@jest/environment': 26.6.2 '@jest/source-map': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 co: 4.6.0 expect: 26.6.2 @@ -13489,7 +13489,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 dev: true /jest-pnp-resolver/1.2.3_jest-resolve@24.9.0: @@ -13556,7 +13556,7 @@ packages: jest-pnp-resolver: 1.2.3_jest-resolve@26.6.2 jest-util: 26.6.2 read-pkg-up: 7.0.1 - resolve: 1.22.5 + resolve: 1.22.6 slash: 3.0.0 dev: true @@ -13595,7 +13595,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -13627,7 +13627,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -13659,7 +13659,7 @@ packages: '@jest/environment': 26.6.2 '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 emittery: 0.7.2 exit: 0.1.2 @@ -13844,7 +13844,7 @@ packages: resolution: {integrity: sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g==} engines: {node: '>= 10.14.2'} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 graceful-fs: 4.2.11 dev: true @@ -13873,7 +13873,7 @@ packages: dependencies: '@babel/types': 7.22.19 '@jest/types': 26.6.2 - '@types/babel__traverse': 7.20.1 + '@types/babel__traverse': 7.20.2 '@types/prettier': 2.7.3 chalk: 4.1.2 expect: 26.6.2 @@ -13912,7 +13912,7 @@ packages: engines: {node: '>= 10.14.2'} dependencies: '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 chalk: 4.1.2 graceful-fs: 4.2.11 is-ci: 2.0.0 @@ -13949,7 +13949,7 @@ packages: dependencies: '@jest/test-result': 26.6.2 '@jest/types': 26.6.2 - '@types/node': 20.6.1 + '@types/node': 20.6.2 ansi-escapes: 4.3.2 chalk: 4.1.2 jest-util: 26.6.2 @@ -13968,7 +13968,7 @@ packages: resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 merge-stream: 2.0.0 supports-color: 7.2.0 dev: true @@ -14558,7 +14558,7 @@ packages: is-plain-object: 2.0.4 object.map: 1.0.1 rechoir: 0.6.2 - resolve: 1.22.5 + resolve: 1.22.6 dev: false /lilconfig/2.0.4: @@ -15031,7 +15031,7 @@ packages: dependencies: findup-sync: 2.0.0 micromatch: 3.1.10 - resolve: 1.22.5 + resolve: 1.22.6 stack-trace: 0.0.10 dev: false @@ -15887,7 +15887,7 @@ packages: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: hosted-git-info: 2.8.9 - resolve: 1.22.5 + resolve: 1.22.6 semver: 5.7.2 validate-npm-package-license: 3.0.4 @@ -16930,7 +16930,7 @@ packages: postcss: 7.0.39 postcss-value-parser: 3.3.1 read-cache: 1.0.0 - resolve: 1.22.5 + resolve: 1.22.6 dev: true /postcss-less/2.0.0: @@ -17916,7 +17916,7 @@ packages: resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==} engines: {node: '>= 0.10'} dependencies: - resolve: 1.22.5 + resolve: 1.22.6 /redent/1.0.0: resolution: {integrity: sha512-qtW5hKzGQZqKoh6JNSD+4lfitfPKGz42e6QwiRmPM5mmKtR0N41AbJRYu0xJi7nhOJ4WDgRkKvAk6tw4WIwR4g==} @@ -18375,8 +18375,8 @@ packages: path-parse: 1.0.7 dev: true - /resolve/1.22.5: - resolution: {integrity: sha512-qWhv7PF1V95QPvRoUGHxOtnAlEvlXBylMZcjUR9pAumMmveFtcHJRXGIr+TkjfNJVQypqv2qcDiiars2y1PsSg==} + /resolve/1.22.6: + resolution: {integrity: sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==} hasBin: true dependencies: is-core-module: 2.13.0 @@ -18778,7 +18778,7 @@ packages: resolution: {integrity: sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==} engines: {node: '>= 8.9.0'} dependencies: - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.13 ajv: 6.12.6 ajv-keywords: 3.5.2_ajv@6.12.6 dev: true @@ -18787,7 +18787,7 @@ packages: resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.13 ajv: 6.12.6 ajv-keywords: 3.5.2_ajv@6.12.6 dev: true @@ -20578,7 +20578,7 @@ packages: engines: {node: '>=10.0.0'} hasBin: true dependencies: - '@types/json-schema': 7.0.12 + '@types/json-schema': 7.0.13 commander: 11.0.0 glob: 8.1.0 json5: 2.2.3 @@ -20601,7 +20601,7 @@ packages: typescript: 4.9.5 dev: true - /ts-node/10.9.0_hpm3aou6wkfm6xthbsdh7q76bm: + /ts-node/10.9.0_3puo4rtspwl3idxgm5pkqjgczy: resolution: {integrity: sha512-bunW18GUyaCSYRev4DPf4SQpom3pWH29wKl0sDk5zE7ze19RImEVhCW7K4v3hHKkUyfWotU08ToE2RS+Y49aug==} hasBin: true peerDependencies: @@ -20620,7 +20620,7 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.6.1 + '@types/node': 20.6.2 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 @@ -20667,7 +20667,7 @@ packages: glob: 7.2.3 js-yaml: 3.14.1 minimatch: 3.1.2 - resolve: 1.22.5 + resolve: 1.22.6 semver: 5.7.2 tslib: 1.14.1 tsutils: 2.29.0_typescript@4.9.5 @@ -21413,7 +21413,7 @@ packages: remove-trailing-separator: 1.1.0 replace-ext: 1.0.1 - /vite-node/0.30.1_nwnqd35ww6cke2z4dj7h2jtksq: + /vite-node/0.30.1_cm2ifh3gw4aehqhb6wklfhbq74: resolution: {integrity: sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==} engines: {node: '>=v14.18.0'} hasBin: true @@ -21423,7 +21423,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 3.2.6_nwnqd35ww6cke2z4dj7h2jtksq + vite: 3.2.6_cm2ifh3gw4aehqhb6wklfhbq74 transitivePeerDependencies: - '@types/node' - less @@ -21461,13 +21461,13 @@ packages: dependencies: esbuild: 0.15.18 postcss: 8.4.21 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 2.79.1 optionalDependencies: fsevents: 2.3.3 dev: true - /vite/3.2.6_@types+node@20.6.1: + /vite/3.2.6_@types+node@20.6.2: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -21492,16 +21492,16 @@ packages: terser: optional: true dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 esbuild: 0.15.18 postcss: 8.4.21 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 2.79.1 optionalDependencies: fsevents: 2.3.3 dev: true - /vite/3.2.6_nwnqd35ww6cke2z4dj7h2jtksq: + /vite/3.2.6_cm2ifh3gw4aehqhb6wklfhbq74: resolution: {integrity: sha512-nTXTxYVvaQNLoW5BQ8PNNQ3lPia57gzsQU/Khv+JvzKPku8kNZL6NMUR/qwXhMG6E+g1idqEPanomJ+VZgixEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -21526,11 +21526,11 @@ packages: terser: optional: true dependencies: - '@types/node': 20.6.1 + '@types/node': 20.6.2 esbuild: 0.15.18 less: 4.1.3 postcss: 8.4.21 - resolve: 1.22.5 + resolve: 1.22.6 rollup: 2.79.1 terser: 5.17.1 optionalDependencies: @@ -21570,7 +21570,7 @@ packages: dependencies: '@types/chai': 4.3.6 '@types/chai-subset': 1.3.3 - '@types/node': 20.6.1 + '@types/node': 20.6.2 '@vitest/expect': 0.30.1 '@vitest/runner': 0.30.1 '@vitest/snapshot': 0.30.1 @@ -21591,8 +21591,8 @@ packages: strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.4.0 - vite: 3.2.6_nwnqd35ww6cke2z4dj7h2jtksq - vite-node: 0.30.1_nwnqd35ww6cke2z4dj7h2jtksq + vite: 3.2.6_cm2ifh3gw4aehqhb6wklfhbq74 + vite-node: 0.30.1_cm2ifh3gw4aehqhb6wklfhbq74 why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 4c84ff9dcd..b127f5ba42 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.3.2","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.3.3","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md index b4cc28089c..ef519a4e87 100644 --- a/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md +++ b/docs/assets/guide/en/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md @@ -36,7 +36,7 @@ Three canvases need to be declared, and pay attention to the order of declaratio - `bar_tooltip_canvas` is used to draw the canvas of the tooltip. The tooltip of the cross-end environment is drawn using the canvas. ```html - + { if (!domRef) { - console.error(`#${item.id} canvas not found`); + console.error(`未找到 #${item.id} 画布`); return; } domRef.id = item.id; const pixelRatio = SystemInfo.pixelRatio; - const chartInstance = new ChartSpace( - { - width: domRef.width, // Tip: Cross-end environment needs to manually pass in the width and height - height: domRef.height, - ...item.spec + const chartInstance = new VChart(item.spec, { + mode: 'lynx', // Tip: 跨端环境需要手动传入 mode + // 跨端参数 + modeParams: { + domref: domRef, // 图表绘制的 canvas 节点 + force: true, // 是否强制使用 canvas 绘制 + canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId 列表 + tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId + freeCanvasIdx: 1 // 自由 canvas 索引 }, - { - mode: 'lynx', // Tip: Cross-end environment needs to manually pass in mode - // Cross-end parameters - modeParams: { - domref: domRef, // Canvas node for chart drawing - force: true, // Whether to force the use of canvas for drawing - canvasIdLists: [`${item.id}_draw_canvas`, `${item.id}_tooltip_canvas`, `${item.id}_hidden_canvas`], // canvasId list - tooltipCanvasId: `${item.id}_tooltip_canvas`, // tooltip canvasId - freeCanvasIdx: 1 // Free canvas index - }, - dpr: pixelRatio, // Tip: Cross-end environment needs to manually pass in dpr - renderCanvas: `${item.id}_draw_canvas` // Declare the canvasId used for drawing - // animation: false - } - ); + dpr: pixelRatio, // Tip: 跨端环境需要手动传入 dpr + renderCanvas: `${item.id}_draw_canvas` // 声明用于绘制的 canvasId + }); item.chart = chartInstance; if (item.events) { @@ -184,7 +176,7 @@ Card({ const targetChart = this.data.chartList.find(x => x.id === id); const chartInstance = targetChart?.chart; if (chartInstance) { - event.target = chartInstance.getCanvas(); // Tip: Must be set + event.target = chartInstance.getCanvas(); // Tip: 必须设置 chartInstance.getStage().window.dispatchEvent(event); } } diff --git a/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md b/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md index c8da3548f9..964d762670 100644 --- a/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md +++ b/docs/assets/guide/zh/tutorial_docs/Cross-terminal_and_Developer_Ecology/lynx.md @@ -36,7 +36,7 @@ Lynx 是字节内用 Web 技术栈快速构建 Native 视图的高性能跨端 - `bar_tooltip_canvas` 用于绘制 tooltip 的 canvas,跨端环境的 tooltip 使用 canvas 绘制。 ```html - + t;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){this._brushComponents&&(this._container.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){this._titleComponent&&(this._container.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{this.event.emit(cK.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.2",Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function vn(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){var t;this._component&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){var t;this._brushComponents&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){var t;this._legendComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){var t;this._indicatorComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){var t;this._titleComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{var t;this.event.emit(cK.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(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){var t;super.clear(),this._playerComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._playerComponent)),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.3",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 40df10b3da..a5d89f8463 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.3.2", + "version": "1.3.3", "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 1e3a0184d0..857f07c7a2 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function vn(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){this._brushComponents&&(this._container.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){this._titleComponent&&(this._container.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{this.event.emit(cK.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.2",Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function vn(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){var t;this._component&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){var t;this._brushComponents&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){var t;this._legendComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){var t;this._indicatorComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){var t;this._titleComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{var t;this.event.emit(cK.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(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){var t;super.clear(),this._playerComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._playerComponent)),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.3",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 77436803ea..15439851c3 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.3.2", + "version": "1.3.3", "description": "The react version of VChart 4.x", "keywords": [ "react", @@ -28,7 +28,7 @@ "prepublishOnly": "npm run build" }, "dependencies": { - "@visactor/vchart": "workspace:1.3.2", + "@visactor/vchart": "workspace:1.3.3", "@visactor/vutils": "~0.15.14", "@visactor/vgrammar": "~0.6.6", "@visactor/vrender": "~0.14.8", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index eb42c81775..8c0989445e 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.3.2", + "version": "1.3.3", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "lib/src/index.js", @@ -40,7 +40,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.3.2" + "@visactor/vchart": "workspace:1.3.3" }, "devDependencies": { "@internal/eslint-config": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index 1e3a0184d0..857f07c7a2 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function vn(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){this._component&&(this._container.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){this._brushComponents&&(this._container.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){this._legendComponent&&(this._container.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){this._indicatorComponent&&(this._container.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){this._titleComponent&&(this._container.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this._container)||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{this._spec.auto&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{this.event.emit(cK.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})),this._spec.loop&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){super.clear(),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.2",Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function vn(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);st;var _n,bn;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["desktop-miniApp"]="desktop-miniApp",_n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.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"}(bn||(bn={}));function xn(){return new Sn}function Sn(){this.reset()}Sn.prototype={constructor:Sn,reset:function(){this.s=this.t=0},add:function(t){An(wn,t,this.t),An(this,wn.s,this.s),this.s?this.t+=wn.t:this.s=wn.t},valueOf:function(){return this.s}};var wn=new Sn;function An(t,e,i){var n=t.s=e+i,s=n-e,r=n-s;t.t=e-r+(i-s)}var kn=1e-6,Mn=Math.PI,Cn=Mn/2,Tn=Mn/4,En=2*Mn,Pn=180/Mn,Rn=Mn/180,On=Math.abs,Bn=Math.atan,In=Math.atan2,Dn=Math.cos,Ln=Math.exp,Fn=Math.log,jn=Math.pow,zn=Math.sin,Hn=Math.sign||function(t){return t>0?1:t<0?-1:0},Nn=Math.sqrt,Vn=Math.tan;function Wn(t){return t>1?0:t<-1?Mn:Math.acos(t)}function Gn(t){return t>1?Cn:t<-1?-Cn:Math.asin(t)}function Un(){}function Yn(t,e){t&&$n.hasOwnProperty(t.type)&&$n[t.type](t,e)}var Xn={Feature:function(t,e){Yn(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,s=i.length;++nMn?t+Math.round(-t/En)*En:t,e]}function os(t,e,i){return(t%=En)?e||i?rs(hs(t),cs(e,i)):hs(t):e||i?cs(e,i):as}function ls(t){return function(e,i){return[(e+=t)>Mn?e-En:e<-Mn?e+En:e,i]}}function hs(t){var e=ls(t);return e.invert=ls(-t),e}function cs(t,e){var i=Dn(t),n=zn(t),s=Dn(e),r=zn(e);function a(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*i+o*n;return[In(l*s-c*r,o*i-h*n),Gn(c*s+l*r)]}return a.invert=function(t,e){var a=Dn(e),o=Dn(t)*a,l=zn(t)*a,h=zn(e),c=h*s-l*r;return[In(l*s+h*r,o*i+c*n),Gn(c*i-o*n)]},a}function ds(t,e){(e=Qn(e))[0]-=t,ss(e);var i=Wn(-e[1]);return((-e[2]<0?-i:i)+En-kn)%En}function us(){var t,e=[];return{point:function(e,i,n){t.push([e,i,n])},lineStart:function(){e.push(t=[])},lineEnd:Un,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ps(t,e){return On(t[0]-e[0])=0;--r)s.point((c=h[r])[0],c[1]);else n(u.x,u.p.x,-1,s);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);s.lineEnd()}}}function vs(t){if(e=t.length){for(var e,i,n=0,s=t[0];++ne?1:t>=e?0:NaN}function bs(t){for(var e,i,n,s=t.length,r=-1,a=0;++r=0;)for(e=(n=t[s]).length;--e>=0;)i[--a]=n[e];return i}function xs(t,e,i,n){return function(s){var r,a,o,l=e(s),h=us(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:v,polygonStart:function(){u.point=m,u.lineStart=y,u.lineEnd=_,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=v,a=bs(a);var t=function(t,e){var i=ys(e),n=e[1],s=zn(n),r=[zn(i),-Dn(i),0],a=0,o=0;ms.reset(),1===s?n=Cn+kn:-1===s&&(n=-Cn-kn);for(var l=0,h=t.length;l=0?1:-1,k=A*w,M=k>Mn,C=f*x;if(ms.add(In(C*A*zn(k),v*S+C*Dn(k))),a+=M?w+A*En:w,M^p>=i^_>=i){var T=es(Qn(u),Qn(y));ss(T);var E=es(r,T);ss(E);var P=(M^w>=0?-1:1)*Gn(E[2]);(n>P||n===P&&(T[0]||T[1]))&&(o+=M^w>=0?1:-1)}}return(a<-kn||a0){for(d||(s.polygonStart(),d=!0),s.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(Ss))}return u}}function Ss(t){return t.length>1}function ws(t,e){return((t=t.x)[0]<0?t[1]-Cn-kn:Cn-t[1])-((e=e.x)[0]<0?e[1]-Cn-kn:Cn-e[1])}!function(t){var e;1===t.length&&(e=t,t=function(t,i){return _s(e(t),i)})}(_s);var As=xs((function(){return!0}),(function(t){var e,i=NaN,n=NaN,s=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Mn:-Mn,l=On(r-i);On(l-Mn)0?Cn:-Cn),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),t.point(r,n),e=0):s!==o&&l>=Mn&&(On(i-s)kn?Bn((zn(e)*(r=Dn(n))*zn(i)-zn(n)*(s=Dn(e))*zn(t))/(s*r*a)):(e+n)/2}(i,n,r,a),t.point(s,n),t.lineEnd(),t.lineStart(),t.point(o,n),e=0),t.point(i=r,n=a),s=o},lineEnd:function(){t.lineEnd(),i=n=NaN},clean:function(){return 2-e}}}),(function(t,e,i,n){var s;if(null==t)s=i*Cn,n.point(-Mn,s),n.point(0,s),n.point(Mn,s),n.point(Mn,0),n.point(Mn,-s),n.point(0,-s),n.point(-Mn,-s),n.point(-Mn,0),n.point(-Mn,s);else if(On(t[0]-e[0])>kn){var r=t[0]0,s=On(e)>kn;function r(t,i){return Dn(t)*Dn(i)>e}function a(t,i,n){var s=[1,0,0],r=es(Qn(t),Qn(i)),a=ts(r,r),o=r[0],l=a-o*o;if(!l)return!n&&t;var h=e*a/l,c=-e*o/l,d=es(s,r),u=ns(s,h);is(u,ns(r,c));var p=d,g=ts(u,p),f=ts(p,p),v=g*g-f*(ts(u,u)-1);if(!(v<0)){var m=Nn(v),y=ns(p,(-g-m)/f);if(is(y,u),y=Jn(y),!n)return y;var _,b=t[0],x=i[0],S=t[1],w=i[1];x0^y[1]<(On(y[0]-b)Mn^(b<=y[0]&&y[0]<=x)){var M=ns(p,(-g+m)/f);return is(M,u),[y,Jn(M)]}}}function o(e,i){var s=n?t:Mn-t,r=0;return e<-s?r|=1:e>s&&(r|=2),i<-s?r|=4:i>s&&(r|=8),r}return xs(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),v=n?f?0:o(d,u):f?o(d+(d<0?Mn:-Mn),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||ps(e,p)||ps(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(s&&e&&n^f){var m;v&i||!(m=a(g,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1],3)))}!f||e&&ps(e,g)||t.point(g[0],g[1]),e=g,l=f,i=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,n,s,r){!function(t,e,i,n,s,r){if(i){var a=Dn(e),o=zn(e),l=n*i;null==s?(s=e+n*En,r=e-l/2):(s=ds(a,s),r=ds(a,r),(n>0?sr)&&(s+=n*En));for(var h,c=s;n>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?n:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(n,s){return On(n[0]-t)0?0:3:On(n[0]-i)0?2:1:On(n[1]-e)0?1:0:s>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),n=a(e,1);return i!==n?i-n: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,v,m,y,_=a,b=us(),x={point:S,lineStart:function(){x.point=w,h&&h.push(c=[]);m=!0,v=!1,g=f=NaN},lineEnd:function(){l&&(w(d,u),p&&v&&b.rejoin(),l.push(b.result()));x.point=S,v&&_.lineEnd()},polygonStart:function(){_=b,l=[],h=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,s=h.length;in&&(u-r)*(n-a)>(p-a)*(t-r)&&++e:p<=n&&(u-r)*(n-a)<(p-a)*(t-r)&&--e;return e}(),i=y&&e,s=(l=bs(l)).length;(i||s)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),s&&fs(l,o,e,r,a),a.polygonEnd());_=a,l=h=c=null}};function S(t,e){s(t,e)&&_.point(t,e)}function w(r,a){var o=s(r,a);if(h&&c.push([r,a]),m)d=r,u=a,p=o,m=!1,o&&(_.lineStart(),_.point(r,a));else if(o&&v)_.point(r,a);else{var l=[g=Math.max(Cs,Math.min(Ms,g)),f=Math.max(Cs,Math.min(Ms,f))],b=[r=Math.max(Cs,Math.min(Ms,r)),a=Math.max(Cs,Math.min(Ms,a))];!function(t,e,i,n,s,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=s-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,n)?o&&(_.lineStart(),_.point(r,a),y=!1):(v||(_.lineStart(),_.point(l[0],l[1])),_.point(b[0],b[1]),o||_.lineEnd(),y=!1)}g=r,f=a,v=o}return x}}function Es(t){return t}var Ps,Rs,Os,Bs,Is=xn(),Ds=xn(),Ls={point:Un,lineStart:Un,lineEnd:Un,polygonStart:function(){Ls.lineStart=Fs,Ls.lineEnd=Hs},polygonEnd:function(){Ls.lineStart=Ls.lineEnd=Ls.point=Un,Is.add(On(Ds)),Ds.reset()},result:function(){var t=Is/2;return Is.reset(),t}};function Fs(){Ls.point=js}function js(t,e){Ls.point=zs,Ps=Os=t,Rs=Bs=e}function zs(t,e){Ds.add(Bs*t-Os*e),Os=t,Bs=e}function Hs(){zs(Ps,Rs)}var Ns=Ls,Vs=1/0,Ws=Vs,Gs=-Vs,Us=Gs;var Ys,Xs,$s,Ks,qs={point:function(t,e){tGs&&(Gs=t);eUs&&(Us=e)},lineStart:Un,lineEnd:Un,polygonStart:Un,polygonEnd:Un,result:function(){var t=[[Vs,Ws],[Gs,Us]];return Gs=Us=-(Ws=Vs=1/0),t}},Zs=0,Js=0,Qs=0,tr=0,er=0,ir=0,nr=0,sr=0,rr=0,ar={point:or,lineStart:lr,lineEnd:dr,polygonStart:function(){ar.lineStart=ur,ar.lineEnd=pr},polygonEnd:function(){ar.point=or,ar.lineStart=lr,ar.lineEnd=dr},result:function(){var t=rr?[nr/rr,sr/rr]:ir?[tr/ir,er/ir]:Qs?[Zs/Qs,Js/Qs]:[NaN,NaN];return Zs=Js=Qs=tr=er=ir=nr=sr=rr=0,t}};function or(t,e){Zs+=t,Js+=e,++Qs}function lr(){ar.point=hr}function hr(t,e){ar.point=cr,or($s=t,Ks=e)}function cr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,or($s=t,Ks=e)}function dr(){ar.point=or}function ur(){ar.point=gr}function pr(){fr(Ys,Xs)}function gr(t,e){ar.point=fr,or(Ys=$s=t,Xs=Ks=e)}function fr(t,e){var i=t-$s,n=e-Ks,s=Nn(i*i+n*n);tr+=s*($s+t)/2,er+=s*(Ks+e)/2,ir+=s,nr+=(s=Ks*t-$s*e)*($s+t),sr+=s*(Ks+e),rr+=3*s,or($s=t,Ks=e)}var vr=ar;function mr(t){this._context=t}mr.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,En)}},result:Un};var yr,_r,br,xr,Sr,wr=xn(),Ar={point:Un,lineStart:function(){Ar.point=kr},lineEnd:function(){yr&&Mr(_r,br),Ar.point=Un},polygonStart:function(){yr=!0},polygonEnd:function(){yr=null},result:function(){var t=+wr;return wr.reset(),t}};function kr(t,e){Ar.point=Mr,_r=xr=t,br=Sr=e}function Mr(t,e){xr-=t,Sr-=e,wr.add(Nn(xr*xr+Sr*Sr)),xr=t,Sr=e}var Cr=Ar;function Tr(){this._string=[]}function Er(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Pr(t,e){var i,n,s=4.5;function r(t){return t&&("function"==typeof s&&n.pointRadius(+s.apply(this,arguments)),Zn(t,i(n))),n.result()}return r.area=function(t){return Zn(t,i(Ns)),Ns.result()},r.measure=function(t){return Zn(t,i(Cr)),Cr.result()},r.bounds=function(t){return Zn(t,i(qs)),qs.result()},r.centroid=function(t){return Zn(t,i(vr)),vr.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Es):(t=e).stream,r):t},r.context=function(t){return arguments.length?(n=null==t?(e=null,new Tr):new mr(e=t),"function"!=typeof s&&n.pointRadius(s),r):e},r.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(n.pointRadius(+t),+t),r):s},r.projection(t).context(e)}function Rr(t){return function(e){var i=new Or;for(var n in t)i[n]=t[n];return i.stream=e,i}}function Or(){}function Br(t,e,i){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=n&&t.clipExtent(null),Zn(i,t.stream(qs)),e(qs.result()),null!=n&&t.clipExtent(n),t}function Ir(t,e,i){return Br(t,(function(i){var n=e[1][0]-e[0][0],s=e[1][1]-e[0][1],r=Math.min(n/(i[1][0]-i[0][0]),s/(i[1][1]-i[0][1])),a=+e[0][0]+(n-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(s-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function Dr(t,e,i){return Ir(t,[[0,0],e],i)}function Lr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][0]-i[0][0]),r=(n-s*(i[1][0]+i[0][0]))/2,a=-s*i[0][1];t.scale(150*s).translate([r,a])}),i)}function Fr(t,e,i){return Br(t,(function(i){var n=+e,s=n/(i[1][1]-i[0][1]),r=-s*i[0][0],a=(n-s*(i[1][1]+i[0][1]))/2;t.scale(150*s).translate([r,a])}),i)}Tr.prototype={_radius:4.5,_circle:Er(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=Er(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}},Or.prototype={constructor:Or,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 jr=16,zr=Dn(30*Rn);function Hr(t,e){return+e?function(t,e){function i(n,s,r,a,o,l,h,c,d,u,p,g,f,v){var m=h-n,y=c-s,_=m*m+y*y;if(_>4*e&&f--){var b=a+u,x=o+p,S=l+g,w=Nn(b*b+x*x+S*S),A=Gn(S/=w),k=On(On(S)-1)e||On((m*E+y*P)/_-.5)>.3||a*u+o*p+l*g2?t[2]%360*Rn:0,E()):[v*Pn,m*Pn,y*Pn]},C.angle=function(t){return arguments.length?(_=t%360*Rn,E()):_*Pn},C.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},C.precision=function(t){return arguments.length?(a=Hr(o,M=t*t),P()):Nn(M)},C.fitExtent=function(t,e){return Ir(C,t,e)},C.fitSize=function(t,e){return Dr(C,t,e)},C.fitWidth=function(t,e){return Lr(C,t,e)},C.fitHeight=function(t,e){return Fr(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&T,E()}}function Yr(t){var e=0,i=Mn/3,n=Ur(t),s=n(e,i);return s.parallels=function(t){return arguments.length?n(e=t[0]*Rn,i=t[1]*Rn):[e*Pn,i*Pn]},s}function Xr(t,e){var i=zn(t),n=(i+zn(e))/2;if(On(n)2?t[2]*Rn:0),e.invert=function(e){return(e=t.invert(e[0]*Rn,e[1]*Rn))[0]*=Pn,e[1]*=Pn,e},e}(s.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===ta?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),n]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,n)]])}return s.scale=function(t){return arguments.length?(a(t),c()):a()},s.translate=function(t){return arguments.length?(o(t),c()):o()},s.center=function(t){return arguments.length?(r(t),c()):r()},s.clipExtent=function(t){return arguments.length?(null==t?h=e=i=n=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],n=+t[1][1]),c()):null==h?null:[[h,e],[i,n]]},c()}function ia(t){return Vn((Cn+t)/2)}function na(t,e){var i=Dn(t),n=t===e?zn(t):Fn(i/Dn(e))/Fn(ia(e)/ia(t)),s=i*jn(ia(t),n)/n;if(!n)return ta;function r(t,e){s>0?e<-Cn+kn&&(e=-Cn+kn):e>Cn-kn&&(e=Cn-kn);var i=s/jn(ia(e),n);return[i*zn(n*t),s-i*Dn(n*t)]}return r.invert=function(t,e){var i=s-e,r=Hn(n)*Nn(t*t+i*i),a=In(t,On(i))*Hn(i);return i*n<0&&(a-=Mn*Hn(t)*Hn(i)),[a/n,2*Bn(jn(s/r,1/n))-Cn]},r}function sa(t,e){return[t,e]}function ra(t,e){var i=Dn(t),n=t===e?zn(t):(i-Dn(e))/(e-t),s=i/n+t;if(On(n)kn&&--s>0);return[t/(.8707+(r=n*n)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),n]},ga.invert=Zr(Gn),fa.invert=Zr((function(t){return 2*Bn(t)})),va.invert=function(t,e){return[-e,2*Bn(Ln(t))-Cn]};var _a={exports:{}},ba=function(t,e){this.p1=t,this.p2=e};ba.prototype.rise=function(){return this.p2[1]-this.p1[1]},ba.prototype.run=function(){return this.p2[0]-this.p1[0]},ba.prototype.slope=function(){return this.rise()/this.run()},ba.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},ba.prototype.isVertical=function(){return!isFinite(this.slope())},ba.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},ba.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},ba.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},ba.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)},ba.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var xa=ba,Sa=function(t,e){for(var i=0,n=0,s=1;s<=t.length-2;s++){var r=new xa(t[0],t[t.length-1]).perpendicularDistance(t[s]);r>i&&(n=s,i=r)}if(i>e)var a=Sa(t.slice(0,n),e),o=Sa(t.slice(n,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},wa=Sa;!function(t){var e=wa;function i(e,i){var n=e.geometry,s=n.type;if("LineString"===s)n.coordinates=t.exports.simplify(n.coordinates,i);else if("Polygon"===s||"MultiLineString"===s)for(var r=0;r1?e-1:0),n=1;n{const i=ka(Ta,e),{tolerance:n}=i;return Aa(t,n)};var Pa;!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"}(Pa||(Pa={}));const Ra=(t,e)=>{var i,n;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const s=e.fields,r=t[0],a={},o=[];for(const e in s)if(Object.prototype.hasOwnProperty.call(s,e)){const l=s[e];if(!l.type){let n=r;e in r||(n=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof n[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===(n=l.domain)||void 0===n?void 0:n.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 n=0;n9999?"+"+La(e,6):La(e,4))+"-"+La(t.getUTCMonth()+1,2)+"-"+La(t.getUTCDate(),2)+(r?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"."+La(r,3)+"Z":s?"T"+La(i,2)+":"+La(n,2)+":"+La(s,2)+"Z":n||i?"T"+La(i,2)+":"+La(n,2)+"Z":"")}function ja(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function n(t,e){var n,s=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ba;if(h)return h=!1,Oa;var e,n,s=a;if(34===t.charCodeAt(s)){for(;a++=r?l=!0:10===(n=t.charCodeAt(a++))?h=!0:13===n&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(s+1,e-1).replace(/""/g,'"')}for(;a0}function Ka(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof n)throw new Error(" must be a boolean");if("boolean"!=typeof s)throw new Error(" must be a boolean");!1===s&&(t=Va(t));var r=[];switch(t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,n)})),t;case"FeatureCollection":return Ka(t,(function(t){Ka(Ja(t,n),(function(t){r.push(t)}))})),pn(r)}return Ja(t,n)}function Ja(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return qa(t,(function(t){Ja(t,e)})),t;case"LineString":return Qa(Xa(t),e),t;case"Polygon":return to(Xa(t),e),t;case"MultiLineString":return Xa(t).forEach((function(t){Qa(t,e)})),t;case"MultiPolygon":return Xa(t).forEach((function(t){to(t,e)})),t;case"Point":case"MultiPoint":return t}}function Qa(t,e){$a(t)===e&&t.reverse()}function to(t,e){$a(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=eo(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ro=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.GEO;const i=ka(no,e),{centroid:n,name:s,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(so(t))})):e.push(so(t))})),e})(t);let o=t.features;return a&&(o=Za(t,{reverse:!c(a)||a.reverse}).features),o.forEach((t=>{if(n){const e=io.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(s&&(t.name=t.properties.name),r){const e=io.bounds(t);t.bbox=e}})),t.features=o,t},ao={},oo=(t,e,i)=>{i.type=Pa.GEO;const n=ka(no,ao,e),{object:s}=n;if(!g(s))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[s])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return ya(a,t)}))}:ya(a,o));var a,o;return ro(r,n,i)},lo=(t,e,i)=>{const n=!a(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!f(t))throw new TypeError("Invalid data: must be DataView array!");return f(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),n&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ho=0;function co(){return ho>1e8&&(ho=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ho++}class uo{constructor(t){let e;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new s,this._callMap=new Map,e=(null==t?void 0:t.name)?t.name:co("dataset"),this.name=e}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){if(this.dataViewMap[t])throw new Error(`Error: dataView ${t} 之前已存在,请重新命名`);this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){this.parserMap[t]&&console.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){this.transformMap[t]&&console.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){let n=this._callMap.get(i);n||(n=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,n)})),this._callMap.set(i,n)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){const n=this._callMap.get(i);n&&t.forEach((t=>{t.target.removeListener(e,n)})),this._callMap.delete(i)}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const po="_data-view-diff-rank";class go{constructor(t,e){var i=this;let n;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new s,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.historyData=[],this.parserData={},this.latestData={},this._fields=null,this._diffData=!1,this._diffKeys=null,this._diffMap=new Map,this._diffRank=0,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,Object.assign(Object.assign({},t),{emitMessage:!1})),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==(null==t?void 0:t.emitMessage)&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},n=(null==e?void 0:e.name)?e.name:co("dataview"),this.name=n,(null==e?void 0:e.history)&&(this.history=e.history),this.dataSet.setDataView(n,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const s=this.cloneParseData(t,e);if(null==e?void 0:e.type){e=R(e);const t=(null!==(n=this.dataSet.getParser(e.type))&&void 0!==n?n:this.dataSet.getParser("bytejson"))(s,e.options,this);this.rawData=s,this.parserData=t,this.history&&this.historyData.push(s,t),this.latestData=t}else this.parserData=s,this.rawData=s,this.history&&this.historyData.push(s),this.latestData=s;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);t=R(t),this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.sort(((t,e)=>{var i,n;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(n=e.level)&&void 0!==n?n:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:n}=e,s=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(s),this.latestData=s,!1!==n&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t}disableDiff(){this._diffData=!1,this.resetDiff()}resetDiff(){this._diffMap=new Map,this._diffRank=0}diffLastData(){var t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[po]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[po]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[po]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?D({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!l(this._fields)&&l(i)?(this.dataSet.registerTransform("fields",Ra),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.resetDiff(),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class fo{static getInstance(){return fo.instance||(fo.instance=new fo),fo.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 n=this.shortWeekdayRe.exec(e.slice(i));return n?(t.w=this.shortWeekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseWeekday=(t,e,i)=>{const n=this.weekdayRe.exec(e.slice(i));return n?(t.w=this.weekdayLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseShortMonth=(t,e,i)=>{const n=this.shortMonthRe.exec(e.slice(i));return n?(t.m=this.shortMonthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseMonth=(t,e,i)=>{const n=this.monthRe.exec(e.slice(i));return n?(t.m=this.monthLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.d=+n[0],i+n[0].length):-1},this.parseHour24=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.H=+n[0],i+n[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+3));return n?(t.L=+n[0],i+n[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.m=n-1,i+n[0].length):-1},this.parseMinutes=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.M=+n[0],i+n[0].length):-1},this.parsePeriod=(t,e,i)=>{const n=this.periodRe.exec(e.slice(i));return n?(t.p=this.periodLookup.get(n[0].toLowerCase()),i+n[0].length):-1},this.parseSeconds=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+2));return n?(t.S=+n[0],i+n[0].length):-1},this.parseFullYear=(t,e,i)=>{const n=this.numberRe.exec(e.slice(i,i+4));return n?(t.y=+n[0],i+n[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 n=t<0?"-":"",s=(n?-t:t)+"",r=s.length;return n+(r=a)return-1;if(o=e.charCodeAt(s++),37===o){if(o=e.charAt(s++),l=this.parses[o in this.pads?e.charAt(s++):o],!l||(n=l(t,i,n))<0)return-1}else if(o!==i.charCodeAt(n++))return-1}return n}newParse(t,e){const i=this;return function(n){const s=i.newDate(1900,void 0,1);return i.parseSpecifier(s,t,n+="",0)!==n.length?null:"Q"in s?new Date(s.Q):"s"in s?new Date(1e3*s.s+("L"in s?s.L:0)):(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,i.utcDate(s)):i.localDate(s))}}newFormat(t,e){const i=this;return function(n){const s=[];let r=-1,a=0;const o=t.length;let l,h,c;for(n instanceof Date||(n=new Date(+n));++r(o(bo.warnHandler)&&bo.warnHandler.call(null,t,e),e?qe.getInstance().warn(`[VChart warn]: ${t}`,e):qe.getInstance().warn(`[VChart warn]: ${t}`)),_o=(t,e,i)=>{if(!o(bo.errorHandler))throw new Error(t);bo.errorHandler.call(null,t,e)},bo={silent:!1,warnHandler:!1,errorHandler:!1},xo="undefined"!=typeof window&&void 0!==window.document,So=xo&&globalThis.document;function wo(t){return("desktop-browser"===t||"mobile-browser"===t)&&xo}function Ao(t){return"miniApp"===t||"mobile-browser"===t}function ko(t){return t.includes("miniApp")||"lynx"===t}let Mo=0;function Co(){return Mo>=9999999&&(Mo=0),Mo++}function To(t){return!l(t)&&(!!y(t)||+t==+t)}function Eo(t){return!(!t||0===t.length)&&(!l(t[0])&&!l(t[0].dataId)&&f(t[0].fields))}const Po=(t,e,i)=>(t.fields=e||[],t.fname=i,t);const Ro=t=>e=>T(e,t),Oo=t=>{qe.getInstance().error(t)},Bo=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(o(t))return t;const n=(t=>{const e=[],i=t.length;let n,s,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(n,s)),l="",n=s+1};for(n=0,s=0;sn&&h(),n=s+1,o=n):"]"===r&&(o||Oo("Access path missing open bracket: "+t),o>0&&h(),o=0,n=s+1):s>n?h():n=s+1}return o&&Oo("Access path missing closing bracket: "+t),a&&Oo("Access path missing closing quote: "+t),s>n&&(s+=1,h()),e})(t),s=1===n.length?n[0]:t;return Po((i&&i.get||Ro)(n),[s],e||s)},Io=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(f(t)){const n=t.map((t=>Bo(t,e,i)));return t=>n.map((e=>e(t)))}return Bo(t,e,i)};Io("id");const Do=Po((function(t){return t}),[],"identity"),Lo=Po((function(){return 0}),[],"zero");Po((function(){return 1}),[],"one"),Po((function(){return!0}),[],"true"),Po((function(){return!1}),[],"false"),Po((function(){return{}}),[],"emptyObject");const Fo=(t,e)=>{if((te||l(e))&&!l(t))return 1;const i=e instanceof Date?+e:e,n=t instanceof Date?+t:t;return Number.isNaN(n)&&!Number.isNaN(i)?-1:Number.isNaN(i)&&!Number.isNaN(n)?1:0},jo=(t,e)=>{return 1===t.length?(i=t[0],n=e[0],(t,e)=>Fo(i(t),i(e))*n):((t,e,i)=>(e.push(0),(n,s)=>{let r,a=0,o=-1;for(;0===a&&o+12&&void 0!==arguments[2]?arguments[2]:{};const n=V(e)||[],s=[],r=[],a={},h=i.comparator||jo;return V(t).forEach(((t,e)=>{if(l(t))return;s.push("desc"===n[e]?-1:1);const h=o(t)?t:Io(t,null,i);var c;r.push(h),(c=h,(l(c)?null:c.fields)||[]).forEach((t=>{a[t]=1}))})),0===r.length?null:Po(h(r,s),Object.keys(a))},Ho=(t,e)=>{const i=o(e)?e:t=>t;let n,s;if(t&&t.length){const e=t.length;for(let r=0;r3&&void 0!==arguments[3])||arguments[3];if(e===i)return!0;if(l(e)||l(i))return l(e)&&l(i);if(!d(e)&&!d(i))return e===i;const s=f(e)?e:e[t],r=f(i)?i:i[t];return s===r||!1!==n&&(f(r)?!(!f(s)||r.length!==s.length||!r.every(((t,e)=>t===s[e]))):!!c(r)&&!(!c(s)||Object.keys(r).length!==Object.keys(s).length||!Object.keys(r).every((t=>No(t,r,s)))))},Vo=(t,e)=>l(t)?e:Math.min(g(t)?e*parseFloat(t)/100:t,e);function Wo(t,e,i,n){let s,r,a=-1;t.forEach((t=>{s=e(t),r=i(t),!l(s)&&(s=+s)>=s&&!l(r)&&(r=+r)>=r&&n(s,r,++a)}))}function Go(t,e,i,n,s){let r=0,a=0;return Wo(t,e,i,((t,e)=>{const i=e-s(t),o=e-n;r+=i*i,a+=o*o})),1-r/a}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,n=0,s=0,r=0,a=0,o=0;Wo(t,e,i,((t,e)=>{++o,n+=(t-n)/o,s+=(e-s)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,n){const s=n-t*t,r=Math.abs(s)<1e-24?0:(i-t*e)/s;return[e-r*t,r]}(n,s,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Go(t,e,i,s,h)}}function Yo(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}const Xo=t=>_(t)?Kt(t):null;function $o(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}function Ko(t,e){const i=e?+t[0][e]:+t[0];if(!_(i))return yo("invalid data"),0;return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&n{const n=e?+i[e]:+i;return _(n)&&n>t&&(t=n),t}),i)}function Zo(t,e){return t.reduce(((t,i)=>{const n=e?+i[e]:+i;return _(n)&&(t+=n),t}),0)}function Jo(t,e){let i=0,n=0;t.forEach((t=>{const s=e?+t[e]:+t;_(s)&&(i+=s,n++)}));return i/n}function Qo(t,e){const i=Jo(t,e);if(t.length<=1)return 0;const n=t.reduce(((t,n)=>t+(e?+n[e]:+n-i)**2),0);return n/(t.length-1)}function tl(t){let e="center",i="middle";return e=(t=Yo(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}}function el(t,e){const i=il(t),n=il(e),s=Math.asin((t.x*e.y-e.x*t.y)/i/n),r=Math.acos((t.x*e.x+t.y*e.y)/i/n);return s<0?-r:r}function il(t,e={x:0,y:0}){return Ut.distancePP(t,e)}function nl(t,e,i){let n=!1;if(e&&o(e))for(const s of t)for(const t of s.getSeries(i))if(n=!!e.call(null,t),n)return n;return n}function sl(t,e){const i=[];for(const n of t)for(const t of n.getSeries(e))i.push(t);return i}function rl(t){return function(e){let i;return i=f(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var al;function ol(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:return!0;default:return!1}}function ll(t){switch(t){case al.Linear:case al.Log:case al.Pow:case al.Sqrt:case al.Symlog:case al.Time:case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}function hl(t){switch(t){case al.Ordinal:case al.Point:case al.Band:return!0;default:return!1}}!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(al||(al={}));class cl{_calculateRange(t){if(this._wholeRange)return this._wholeRange;if(this._rangeFactor&&2===t.length){const e=(t[1]-t[0])/(this._rangeFactor[1]-this._rangeFactor[0]),i=t[0]-e*this._rangeFactor[0],n=i,s=e+i;return this._wholeRange=[n,s],this._wholeRange}return t}rangeFactor(t,e){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,this._rangeFactor=t),this):this._rangeFactor}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}}const dl=Symbol("implicit");class ul extends cl{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=al.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=dl}clone(){return(new ul).domain(this._domain).range(this._ordinalRange).unknown(this._unknown)}calculateVisibleDomain(t){return this._rangeFactor&&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 n=this._index.get(e);if(!n){if(this._unknown!==dl)return this._unknown;n=this._domain.push(t),this._index.set(e,n)}return this._ordinalRange[(n-1)%this._ordinalRange.length]}invert(t){let e=0;for(;ee=>e<0?-Math.pow(-e,t):Math.pow(e,t),fl=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),vl=t=>t<0?-t*t:t*t,ml=t=>-Math.log(-t),yl=t=>-Math.exp(-t),_l=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,bl=t=>10===t?_l:t===Math.E?Math.exp:e=>Math.pow(t,e),xl=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),Sl=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),wl=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function Al(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 kl(t,e,i){const n=t[0],s=t[1],r=e[0],a=e[1];let o,l;return sl(o(t))}function Ml(t,e,i){const n=Math.min(t.length,e.length)-1,s=new Array(n),r=new Array(n);let a=-1;for(t[n]{const i=t.slice();let n=0,s=i.length-1,r=i[n],a=i[s];return a1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),n=t/Math.pow(10,i);let s;return s=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,s*Math.pow(10,i)};function El(t,e,i,n){let s;const r=[];let a;if(e=Math.floor(+e),t=Math.floor(+t),!(i=Math.floor(+i)))return[];if(t===e)return[t];if(s=ei&&o>1;)o-=1,a=Math.floor((e-t)/o);let l=t;for(;l<=e;)r.push(l),l+=a;return s&&r.reverse(),r}class Pl extends ul{constructor(t){super(),this.type=al.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t){if(t)return this;this._wholeRange=null;const e=this._calculateRange(this._range),i=super.domain().length,n=e[1]0?n:1:0}(i,this._paddingInner,this._paddingOuter);this._step=(r-s)/Math.max(1,a||1),this._round&&(this._step=Math.floor(this._step)),s+=(r-s-this._step*(i-this._paddingInner))*this._align,this._bandwidth=this._step*(1-this._paddingInner),this._round&&(s=Math.round(s),this._bandwidth=Math.round(this._bandwidth));const o=X(i).map((t=>s+this._step*t));return super.range(n?o.reverse():o),this}calculateVisibleDomain(t){const e=this._domain;if(this._rangeFactor&&e.length){const i=this._getInvertIndex(t[0]),n=this._getInvertIndex(t[1]);return e.slice(Math.min(i,n),Math.max(i,n)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[K(t[0]),K(t[1])],this.rescale(e)):this._range.slice()}rangeRound(t,e){return this._range=[K(t[0]),K(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e.slice():El(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return El(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){const n=[];let s;if(i=gt(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,n=this.bandwidth()/2,s=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=s-1?e:s-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}bandwidth(){return this._bandwidth}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()}clone(){return new Pl(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align)}}const{interpolateRgb:Rl}=fe;function Ol(t,e){const i=typeof e;let n;if(l(e)||"boolean"===i)return()=>e;if("number"===i)return yt(t,e);if("string"===i){if(n=de.parseColorString(e)){const e=Rl(de.parseColorString(t),n);return t=>e(t).formatRgb()}return yt(Number(t),Number(e))}return e instanceof ue?Rl(t,e):e instanceof de?Rl(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),n=e.valueOf(),s=new Date;return t=>(s.setTime(i*(1-t)+n*t),s)}(t,e):yt(Number(t),Number(e))}class Bl extends cl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pl,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pl;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=pl,this._piecewise=kl,this._interpolate=Ol}calculateVisibleDomain(t){var e;return this._rangeFactor&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}scale(t){var e;return t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t)?this._unknown:(this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateRange(this._range),this._interpolate)),this._output(this.transformer(this._clamp(t))))}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),yt)),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 n=Array.from(t,K);return this._domain=n,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=_t,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,n=i.length,s=this._range.length;let r=Math.min(n,s);if(n&&n=2?(e-i[n-2])/t:0;for(let s=1;s<=t;s++)i[n-2+s]=e-a*(t-s);r=s}return void 0===this._clamp&&(this._clamp=gt(i[0],i[r-1])),this._piecewise=r>2?Ml:kl,this._output=this._input=null,this._wholeRange=null,this}clamp(t,e,i){return arguments.length?(this._clamp=e||(t?void 0:pl),this.rescale(i)):this._clamp!==pl}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Il=Math.sqrt(50),Dl=Math.sqrt(10),Ll=Math.sqrt(2),Fl=[1,2,5,10],jl=(t,e,i)=>{let n=1,s=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?s=0:t<0&&t>=-Number.MIN_VALUE?s=-(e-1):!i&&a<1?n=Vl(a).step:(i||a>1)&&(s=Math.floor(t)-r*n),n>0?(t>0?s=Math.max(s,0):t<0&&(s=Math.min(s,-(e-1)*n)),X(0,e).map((t=>s+t*n))):t>0?Hl(0,-(e-1)/n,n):Hl((e-1)/n,0,n)},zl=ht(((t,e,i,n)=>{let s,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((s=e0){let i=Math.round(t/o),n=Math.round(e/o);for(i*oe&&--n,a=new Array(r=n-i+1);++le&&--n,a=new Array(r=n-i+1);++l{let n,s,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,s=new Array(n=o-a+1);++re&&--o,s=new Array(n=o-a+1);++r{let s,r,a;if(i=+i,(t=+t)==(e=+e))return jl(t,i,null==n?void 0:n.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jl(t,i,null==n?void 0:n.noDecimals);(s=e0){let n=1;const{power:s,gap:a}=o,h=10===a?2*10**s:1*10**s;for(;n<=5&&(r=Hl(t,e,l),r.length>i+1)&&i>2;)l+=h,n+=1;i>2&&r.length{let n;const s=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(n=a;n>=1;n--)e.push(s-n*i);return e.concat(t)}if(s>=0){for(n=1;n<=a;n++)t.push(r+n*i);return t}let o=[];const l=[];for(n=1;n<=a;n++)n%2==0?o=[s-Math.floor(n/2)*i].concat(o):l.push(r+Math.ceil(n/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==n?void 0:n.noDecimals)&&l<0&&(l=1),r=Hl(t,e,l);return s&&r.reverse(),r})),Vl=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let n=Fl[0];return i>=Il?n=Fl[3]:i>=Dl?n=Fl[2]:i>=Ll&&(n=Fl[1]),e>=0?{step:n*10**e,gap:n,power:e}:{step:-(10**-e)/n,gap:n,power:e}};function Wl(t,e,i){const n=(e-t)/Math.max(0,i);return Vl(n)}function Gl(t,e,i){let n;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(n=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(n))return[];const s=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,s=0,r=t.length-1,a=t[s],o=t[r],l=10;for(o0;){if(i=Wl(a,o,n).step,i===e)return t[s]=a,t[r]=o,t;if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else{if(!(i<0))break;a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i}e=i}}function Xl(t,e){const i=y(e.forceMin),n=y(e.forceMax);let s=null;const r=[];let a=null;const o=i&&n?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:n?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:y(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),n?r[1]=e.forceMax:y(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),y(r[0])&&y(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):s=y(r[0])||y(r[1])?y(r[0])?"max":"min":"all",{niceType:s,niceDomain:a,niceMinMax:r,domainValidator:o}}const $l=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),Kl=ht(((t,e,i,n,s,r)=>{const a=[],o={},l=s(t),h=s(e);let c=[];if(Number.isInteger(n))c=Nl(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const s=r(i),l=Number.isInteger(n)?$l(t,e,s):$l(t,e,Tl(s)),h=$l(t,e,((t,e)=>{let i,n;return e[0]1&&(o[h]=1,a.push(h))})),a})),ql=ht(((t,e,i,n,s)=>Gl(n(t),n(e),i).map((t=>Tl(s(t))))));class Zl extends Bl{constructor(){super(...arguments),this.type=al.Linear}clone(){return(new Zl).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zl(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(this._rangeFactor&&(this._rangeFactor[0]>0||this._rangeFactor[1]<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const n=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,s=this._domain,r=n[0],a=n[n.length-1];let o=Nl(s[0],s[s.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=n.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,n;const s=this._domain;let r=[];if(e){const t=Xl(s,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Yl(s.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(n=r[0])&&void 0!==n?n:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Yl(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}function Jl(t){return e=>-t(-e)}class Ql extends Bl{constructor(){super(xl(10),bl(10)),this.type=al.Log,this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new Ql).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=xl(this._base),n=bl(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Jl(i),this._pows=Jl(n),this.transformer=ml,this.untransformer=yl):(this._logs=i,this._pows=n,this.transformer=i,this.untransformer=n),this}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return pl}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();let i=e[0],n=e[e.length-1];const s=n0){for(;o<=l;++o)for(r=1;rn)break;h.push(a)}}else for(;o<=l;++o)for(r=this._base-1;r>=1;--r)if(a=o>0?r/this._pows(-o):r*this._pows(o),!(an)break;h.push(a)}2*h.length0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this._pows(Math.floor(this._logs(t))),ceil:t=>this._pows(Math.ceil(this._logs(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class th extends Pl{constructor(t){super(!1),this.type=al.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}}class eh extends Zl{constructor(){super(),this.type=al.Pow,this._exponent=1}clone(){return(new eh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).exponent(this._exponent)}rescale(t){return t||(1===this._exponent?(this.transformer=pl,this.untransformer=pl):.5===this._exponent?(this.transformer=fl,this.untransformer=vl):(this.transformer=gl(this._exponent),this.untransformer=gl(1/this._exponent)),super.rescale()),this}exponent(t,e){return arguments.length?(this._exponent=t,this.rescale(e)):this._exponent}}class ih{constructor(){this.type=al.Quantile,this._range=[],this._domain=[],this._thresholds=[]}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}rescale(t){if(t)return this;let e=0;const i=Math.max(1,this._range.length);for(this._thresholds=new Array(i-1);++e0?this._thresholds[e-1]:this._domain[0],e=this.n?[this._domain[this.n-1],this.x1]:[this._domain[e-1],this._domain[e]]}thresholds(){return this._domain.slice()}domain(t,e){if(!t)return[this.x0,this.x1];const i=Array.from(t);return this.x0=+i[0],this.x1=+i[1],this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return U(this._range,i)?this:(this.n=i.length-1,this._range=i,this.rescale(e))}clone(){return(new nh).domain([this.x0,this.x1],!0).range(this._range).unknown(this._unknown)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Nl(e[0],e[e.length-1],t)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.domain();return Gl(e[0],e[e.length-1],t)}stepTicks(t){const e=this.domain();return Ul(e[0],e[e.length-1],t)}nice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=Yl(this.domain(),t);return e?this.domain(e):this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[this._domain.length-1],i=Yl(this.domain(),t);return i&&(i[i.length-1]=e,this.domain(i)),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this._domain[0],i=Yl(this.domain(),t);return i&&(i[0]=e,this.domain(i)),this}}class sh extends Zl{constructor(){super(fl,vl),this.type=al.Sqrt}clone(){return(new sh).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}}class rh extends Zl{constructor(){super(Sl(1),wl(1)),this.type=al.Symlog,this._const=1}clone(){return(new rh).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=Sl(t),this.untransformer=wl(t),this.rescale(e)):this._const}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kl(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return ql(e[0],e[e.length-1],t,this.transformer,this.untransformer)}nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i;const n=this._domain;let s=[],r=null;if(t){const e=Xl(n,t);if(s=e.niceMinMax,this._domainValidator=e.domainValidator,r=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else r="all";if(r){const t=Cl(n.slice(),{floor:t=>this.untransformer(Math.floor(this.transformer(t))),ceil:t=>this.untransformer(Math.ceil(this.transformer(t)))});return"min"===r?t[t.length-1]=null!==(e=s[1])&&void 0!==e?e:t[t.length-1]:"max"===r&&(t[0]=null!==(i=s[0])&&void 0!==i?i: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}}class ah{constructor(){this.type=al.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!l(t)&&_(+t)?this._range[Z(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 ah).domain(this._domain).range(this._range).unknown(this._unknown)}}const oh=[["second",1,ai],["second",5,5e3],["second",10,1e4],["second",30,3e4],["minute",1,oi],["minute",5,3e5],["minute",10,6e5],["minute",30,18e5],["hour",1,li],["hour",3,3*li],["hour",6,6*li],["hour",12,12*li],["day",1,hi],["day",2,2*hi],["day",7,7*hi],["month",1,ci],["month",3,3*ci],["month",6,6*ci],["year",1,365*hi]];function lh(t){return+wt(t)}function hh(t,e,i,n){const s=(+e-+t)/i,r=Z(oh.map((t=>t[2])),s);if(r===oh.length){const s=Math.max(nt(+t/di,+e/di,i),1),r=t=>(t[ri(n)](Math.floor(t[Je(n)]()/s)*s),t[function(t){return t?"setUTCMonth":"setMonth"}(n)](0,1),t[function(t){return t?"setUTCHours":"setHours"}(n)](0,0,0,0),t),a=(t,e)=>(t[ri(n)](t[Je(n)]()+e*s),t);return{floor:r,offset:a,ceil:on(r,a)}}if(0===r){const n=Math.max(nt(+t,+e,i),1),s=t=>(t.setTime(Math.floor(+t/n)*n),t),r=(t,e)=>(t.setTime(+t+e*n),t);return{floor:s,offset:r,ceil:on(s,r)}}const[a,o]=oh[s/oh[r-1][2]"year"===t&&e?{floor:vi,offset:mi,count:yi,field:_i}:"month"===t&&e?{floor:Ai,offset:ki,count:Mi,field:Ci}:"day"===t&&e?{floor:Oi,offset:Bi,count:Ii,field:Di}:"hour"===t&&e?{floor:Hi,offset:Ni,count:ji,field:Vi}:"minute"===t&&e?{floor:Xi,offset:$i,count:Ui,field:Ki}:"second"===t&&e?{floor:tn,offset:en,count:Ji,field:nn}:"year"===t?{floor:ui,offset:pi,count:gi,field:fi}:"month"===t?{floor:bi,offset:xi,count:Si,field:wi}:"day"===t?{floor:Ti,offset:Ei,count:Pi,field:Ri}:"hour"===t?{floor:Li,offset:Fi,count:ji,field:zi}:"minute"===t?{floor:Wi,offset:Gi,count:Ui,field:Yi}:"second"===t?{floor:qi,offset:Zi,count:Ji,field:Qi}:{floor:sn,offset:rn,count:an})(a,n);return ln(o,l)}class ch extends Bl{constructor(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.type=al.Time,this._domain=t?[Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]:[+new Date(2e3,0,1),+new Date(2e3,0,2)],this._isUtc=t}invert(t){return new Date(super.invert(t))}domain(t,e){if(!t)return this._domain.map(wt);const i=Array.from(t,lh);return this._domain=i,this.rescale(e)}ticks(t){const e=this.domain();let i=e[0],n=e[e.length-1];const s=n{const e=wt(t),s=e[Je(n)](),r=e[Qe(n)]()+1,a=Math.floor((r-1)/3)+1,o=e[ti(n)](),l=e["get"+(n?"UTC":"")+"Day"](),h=e[ei(n)](),c=(h-1)%12+1,d=e[ii(n)](),u=e[ni(n)](),p=e[si(n)]();return(i||"").replace(/YYYY/g,dt(s+"",4,"0","left")).replace(/yyyy/g,s+"").replace(/yy/g,s%100+"").replace(/Q/g,a+"").replace(/MM/g,dt(r,2,"0","left")).replace(/M/g,r+"").replace(/dd/g,dt(o,2,"0","left")).replace(/d/g,o+"").replace(/e/g,l+"").replace(/HH/g,dt(h,2,"0","left")).replace(/H/g,h+"").replace(/hh/g,dt(c+"",2,"0","left")).replace(/h/g,c+"").replace(/mm/g,dt(d,2,"0","left")).replace(/m/g,d+"").replace(/ss/g,dt(u,2,"0","left")).replace(/s/g,u+"").replace(/SSS/g,dt(p,3,"0","left")).replace(/S/g,p+"")};var i,n}clone(){return new ch(this._isUtc).domain(this.domain(),!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}nice(t){const e=this.domain();let i=t;return(y(t)||l(t))&&(i=hh(e[0],e[e.length-1],l(t)?10:t,this._isUtc)),i&&this.domain(Cl(e,i)),this}utc(){return this._isUtc}}function dh(t,e){var i;const n=h(e)&&null!==(i=null==t?void 0:t[e])&&void 0!==i?i:null==t?void 0:t.default;if(!n||f(n))return n;if(c(n)){const{dataScheme:i}=n;return i?vh(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>fh(i)?ph(t,i,e):i)).filter(h)}))):i.map((i=>fh(i)?ph(t,i,e):i)).filter(h):[]}return[]}function uh(t,e){var i,n;return vh(t)?null!==(n=null===(i=t.find((t=>h(t.isAvailable)?o(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!h(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==n?n:t[t.length-1].scheme:t}function ph(t,e,i){var n;const s=h(i)&&null!==(n=t[i])&&void 0!==n?n:t.default;if(!s)return;let r;const{palette:a}=s;if(c(a)){for(const t of V(e.key))if(r=a[t],h(r))break;r||(r=e.default)}if(!r)return;if(!h(e.a)&&!h(e.l)||!g(r))return r;let o=new mo(r);if(h(e.l)){const{r:t,g:i,b:n}=o.color,{h:s,s:r}=ne(t,i,n),a=ie(s,r,e.l),l=new mo(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return h(e.a)&&o.setOpacity(e.a),o.toRGBA()}const gh=(t,e,i)=>{if(fh(t)&&e){const n=ph(e,t,i);if(n)return n}return t};function fh(t){return c(t)&&"palette"===t.type&&!!t.key}function vh(t){return!!f(t)&&t.every((t=>h(t.scheme)))}class mh extends ul{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(!vh(this._range))return void super.range(this._range);const t=uh(this._range,this._domain);super.range(t)}}const yh={linear:Zl,band:Pl,point:th,ordinal:ul,threshold:ah,colorOrdinal:mh};function _h(t){const e=yh[t];return e?new e:null}function bh(t,e){if(!e)return t;const i=e.range(),n=Math.min(i[0],i[i.length-1]),s=Math.max(i[0],i[i.length-1]);return Math.min(Math.max(n,t),s)}function xh(t){return h(null==t?void 0:t.field)&&h(null==t?void 0:t.scale)}function Sh(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function wh(t,e){const{x:i,y:n,width:s,height:r}=e,{x:a,y:o}=t;return an&&a>i}function Ah(t){return!!g(t)&&(!!t.endsWith("%")&&To(t.substring(0,t.length-1)))}function kh(t,e,i){var n,s;return y(t)?t:Ah(t)?Number(t.substring(0,t.length-1))*e/100:o(t)?t(i):c(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(s=t.offset)&&void 0!==s?s:0):0}function Mh(t,e,i){var n,s,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>y(t))))return o.top=null!==(n=t.top)&&void 0!==n?n:0,o.right=null!==(s=t.right)&&void 0!==s?s: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((n=>{o[n]=kh(t[n],e.size,i)}))})),o}function Ch(t){let e={};return f(t)?(l(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),l(t[1])||(e.left=e.right=t[1]),l(t[2])||(e.bottom=t[2]),l(t[3])||(e.left=t[3]),e):y(t)||Ah(t)||o(t)||c(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):c(t)?(e=Object.assign({},t),e):e;var i}function Th(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Eh=(t,e)=>{const i=Number(t),n=t.toString();return isNaN(i)&&"%"===n[n.length-1]?e*(Number(n.slice(0,n.length-1))/100):i};function Ph(t){return t instanceof go}function Rh(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],n=Object.keys(t);return i.every((t=>n.includes(t)))}}function Oh(t){const e=t;let i;if(!h(e)||"object"!=typeof e)return e;if(Ph(e)||Rh(e))return e;const n=f(e),s=e.length;i=n?new Array(s):"object"==typeof e?{}:a(e)||y(e)||g(e)?e:m(e)?new Date(+e):void 0;const r=n?void 0:Object.keys(Object(e));let o=-1;if(i)for(;++o<(r||e).length;){const t=r?r[o]:o,n=e[t];i[t]=Oh(n)}return i}function Bh(t,e,i=!1){if(e){if(t===e)return;if(h(e)&&"object"==typeof e){const n=Object(e),s=[];for(const t in n)s.push(t);let{length:r}=s,a=-1;for(;r--;){const r=s[++a];h(n[r])&&"object"==typeof n[r]&&!f(t[r])?Ih(t,e,r,i):Dh(t,r,n[r])}}}}function Ih(t,e,i,n=!1){const s=t[i],r=e[i];let a=e[i],o=!0;if(f(r)){if(n)a=[];else if(f(s))a=s;else if(v(s)){a=new Array(s.length);let t=-1;const e=s.length;for(;++t{const n=e[i];return t[i]=function(t){return f(t)?{dataScheme:t}:t}(n),t}),{}));let{series:i}=t;const{mark:n,markByName:s}=t;return(n||s)&&(i=Object.keys(mc).reduce(((t,e)=>{var r;const a=null!==(r=null==i?void 0:i[e])&&void 0!==r?r:{},o={};return Object.values(mc[e]).forEach((({type:t,name:e})=>{var i,r;o[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},a[e])})),t[e]=Object.assign(Object.assign({},a),o),t}),{})),Object.assign(Object.assign({},t),{colorScheme:e,series:i})}function bc(t,e,i,n){if(f(e))return e.map((e=>c(e)&&!o(e)?bc(t,e,i,n):e));const s={};return Object.keys(e).forEach((r=>{const a=e[r];if(r.includes("data"))s[r]=a;else if(c(a)){if(o(a)||Ph(a)||Rh(a))return void(s[r]=a);fh(a)?s[r]=gh(a,i,n):s[r]=bc(zh.has(r)?t.includes("spec")?"mark-spec":"mark-theme":t,a,i,n)}else if(t.includes("mark")||"padding"!==r)if(!t.includes("theme")&&"lineHeight"===r&&g(a)&&"%"===a[a.length-1]){if(h(e.fontSize)){const t=Number.parseFloat(a.substring(0,a.length-1))/100,i=e.fontSize*t;_(i)&&(s[r]=i)}}else s[r]=a;else s[r]=Ch(a)})),s}function xc(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(e[n]){i[n]=e[n](t[n]);continue}i[n]=xc(t[n],e)}return i}return f(t)?t.map((t=>xc(t,e))):t}var Sc=function(t){return t&&t.Math==Math&&t},wc=Sc("object"==typeof globalThis&&globalThis)||Sc("object"==typeof window&&window)||Sc("object"==typeof self&&self)||Sc("object"==typeof e&&e)||function(){return this}()||e||Function("return this")(),Ac={},kc=function(t){try{return!!t()}catch(t){return!0}},Mc=!kc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cc=!kc((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),Tc=Cc,Ec=Function.prototype.call,Pc=Tc?Ec.bind(Ec):function(){return Ec.apply(Ec,arguments)},Rc={},Oc={}.propertyIsEnumerable,Bc=Object.getOwnPropertyDescriptor,Ic=Bc&&!Oc.call({1:2},1);Rc.f=Ic?function(t){var e=Bc(this,t);return!!e&&e.enumerable}:Oc;var Dc,Lc,Fc=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},jc=Cc,zc=Function.prototype,Hc=zc.call,Nc=jc&&zc.bind.bind(Hc,Hc),Vc=jc?Nc:function(t){return function(){return Hc.apply(t,arguments)}},Wc=Vc,Gc=Wc({}.toString),Uc=Wc("".slice),Yc=function(t){return Uc(Gc(t),8,-1)},Xc=kc,$c=Yc,Kc=Object,qc=Vc("".split),Zc=Xc((function(){return!Kc("z").propertyIsEnumerable(0)}))?function(t){return"String"==$c(t)?qc(t,""):Kc(t)}:Kc,Jc=function(t){return null==t},Qc=Jc,td=TypeError,ed=function(t){if(Qc(t))throw td("Can't call method on "+t);return t},id=Zc,nd=ed,sd=function(t){return id(nd(t))},rd="object"==typeof document&&document.all,ad={all:rd,IS_HTMLDDA:void 0===rd&&void 0!==rd},od=ad.all,ld=ad.IS_HTMLDDA?function(t){return"function"==typeof t||t===od}:function(t){return"function"==typeof t},hd=ld,cd=ad.all,dd=ad.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:hd(t)||t===cd}:function(t){return"object"==typeof t?null!==t:hd(t)},ud=wc,pd=ld,gd=function(t,e){return arguments.length<2?(i=ud[t],pd(i)?i:void 0):ud[t]&&ud[t][e];var i},fd=Vc({}.isPrototypeOf),vd=wc,md="undefined"!=typeof navigator&&String(navigator.userAgent)||"",yd=vd.process,_d=vd.Deno,bd=yd&&yd.versions||_d&&_d.version,xd=bd&&bd.v8;xd&&(Lc=(Dc=xd.split("."))[0]>0&&Dc[0]<4?1:+(Dc[0]+Dc[1])),!Lc&&md&&(!(Dc=md.match(/Edge\/(\d+)/))||Dc[1]>=74)&&(Dc=md.match(/Chrome\/(\d+)/))&&(Lc=+Dc[1]);var Sd=Lc,wd=kc,Ad=wc.String,kd=!!Object.getOwnPropertySymbols&&!wd((function(){var t=Symbol();return!Ad(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Sd&&Sd<41})),Md=kd&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Cd=gd,Td=ld,Ed=fd,Pd=Object,Rd=Md?function(t){return"symbol"==typeof t}:function(t){var e=Cd("Symbol");return Td(e)&&Ed(e.prototype,Pd(t))},Od=String,Bd=function(t){try{return Od(t)}catch(t){return"Object"}},Id=ld,Dd=Bd,Ld=TypeError,Fd=function(t){if(Id(t))return t;throw Ld(Dd(t)+" is not a function")},jd=Fd,zd=Jc,Hd=function(t,e){var i=t[e];return zd(i)?void 0:jd(i)},Nd=Pc,Vd=ld,Wd=dd,Gd=TypeError,Ud={exports:{}},Yd=wc,Xd=Object.defineProperty,$d=function(t,e){try{Xd(Yd,t,{value:e,configurable:!0,writable:!0})}catch(i){Yd[t]=e}return e},Kd=$d,qd="__core-js_shared__",Zd=wc[qd]||Kd(qd,{}),Jd=Zd;(Ud.exports=function(t,e){return Jd[t]||(Jd[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.31.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Qd=Ud.exports,tu=ed,eu=Object,iu=function(t){return eu(tu(t))},nu=iu,su=Vc({}.hasOwnProperty),ru=Object.hasOwn||function(t,e){return su(nu(t),e)},au=Vc,ou=0,lu=Math.random(),hu=au(1..toString),cu=function(t){return"Symbol("+(void 0===t?"":t)+")_"+hu(++ou+lu,36)},du=Qd,uu=ru,pu=cu,gu=kd,fu=Md,vu=wc.Symbol,mu=du("wks"),yu=fu?vu.for||vu:vu&&vu.withoutSetter||pu,_u=function(t){return uu(mu,t)||(mu[t]=gu&&uu(vu,t)?vu[t]:yu("Symbol."+t)),mu[t]},bu=Pc,xu=dd,Su=Rd,wu=Hd,Au=function(t,e){var i,n;if("string"===e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;if(Vd(i=t.valueOf)&&!Wd(n=Nd(i,t)))return n;if("string"!==e&&Vd(i=t.toString)&&!Wd(n=Nd(i,t)))return n;throw Gd("Can't convert object to primitive value")},ku=TypeError,Mu=_u("toPrimitive"),Cu=function(t,e){if(!xu(t)||Su(t))return t;var i,n=wu(t,Mu);if(n){if(void 0===e&&(e="default"),i=bu(n,t,e),!xu(i)||Su(i))return i;throw ku("Can't convert object to primitive value")}return void 0===e&&(e="number"),Au(t,e)},Tu=Rd,Eu=function(t){var e=Cu(t,"string");return Tu(e)?e:e+""},Pu=dd,Ru=wc.document,Ou=Pu(Ru)&&Pu(Ru.createElement),Bu=function(t){return Ou?Ru.createElement(t):{}},Iu=Bu,Du=!Mc&&!kc((function(){return 7!=Object.defineProperty(Iu("div"),"a",{get:function(){return 7}}).a})),Lu=Mc,Fu=Pc,ju=Rc,zu=Fc,Hu=sd,Nu=Eu,Vu=ru,Wu=Du,Gu=Object.getOwnPropertyDescriptor;Ac.f=Lu?Gu:function(t,e){if(t=Hu(t),e=Nu(e),Wu)try{return Gu(t,e)}catch(t){}if(Vu(t,e))return zu(!Fu(ju.f,t,e),t[e])};var Uu={},Yu=Mc&&kc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xu=dd,$u=String,Ku=TypeError,qu=function(t){if(Xu(t))return t;throw Ku($u(t)+" is not an object")},Zu=Mc,Ju=Du,Qu=Yu,tp=qu,ep=Eu,ip=TypeError,np=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,rp="enumerable",ap="configurable",op="writable";Uu.f=Zu?Qu?function(t,e,i){if(tp(t),e=ep(e),tp(i),"function"==typeof t&&"prototype"===e&&"value"in i&&op in i&&!i[op]){var n=sp(t,e);n&&n[op]&&(t[e]=i.value,i={configurable:ap in i?i[ap]:n[ap],enumerable:rp in i?i[rp]:n[rp],writable:!1})}return np(t,e,i)}:np:function(t,e,i){if(tp(t),e=ep(e),tp(i),Ju)try{return np(t,e,i)}catch(t){}if("get"in i||"set"in i)throw ip("Accessors not supported");return"value"in i&&(t[e]=i.value),t};var lp=Uu,hp=Fc,cp=Mc?function(t,e,i){return lp.f(t,e,hp(1,i))}:function(t,e,i){return t[e]=i,t},dp={exports:{}},up=Mc,pp=ru,gp=Function.prototype,fp=up&&Object.getOwnPropertyDescriptor,vp=pp(gp,"name"),mp={EXISTS:vp,PROPER:vp&&"something"===function(){}.name,CONFIGURABLE:vp&&(!up||up&&fp(gp,"name").configurable)},yp=ld,_p=Zd,bp=Vc(Function.toString);yp(_p.inspectSource)||(_p.inspectSource=function(t){return bp(t)});var xp,Sp,wp,Ap=_p.inspectSource,kp=ld,Mp=wc.WeakMap,Cp=kp(Mp)&&/native code/.test(String(Mp)),Tp=cu,Ep=Qd("keys"),Pp=function(t){return Ep[t]||(Ep[t]=Tp(t))},Rp={},Op=Cp,Bp=wc,Ip=dd,Dp=cp,Lp=ru,Fp=Zd,jp=Pp,zp=Rp,Hp="Object already initialized",Np=Bp.TypeError,Vp=Bp.WeakMap;if(Op||Fp.state){var Wp=Fp.state||(Fp.state=new Vp);Wp.get=Wp.get,Wp.has=Wp.has,Wp.set=Wp.set,xp=function(t,e){if(Wp.has(t))throw Np(Hp);return e.facade=t,Wp.set(t,e),e},Sp=function(t){return Wp.get(t)||{}},wp=function(t){return Wp.has(t)}}else{var Gp=jp("state");zp[Gp]=!0,xp=function(t,e){if(Lp(t,Gp))throw Np(Hp);return e.facade=t,Dp(t,Gp,e),e},Sp=function(t){return Lp(t,Gp)?t[Gp]:{}},wp=function(t){return Lp(t,Gp)}}var Up={set:xp,get:Sp,has:wp,enforce:function(t){return wp(t)?Sp(t):xp(t,{})},getterFor:function(t){return function(e){var i;if(!Ip(e)||(i=Sp(e)).type!==t)throw Np("Incompatible receiver, "+t+" required");return i}}},Yp=Vc,Xp=kc,$p=ld,Kp=ru,qp=Mc,Zp=mp.CONFIGURABLE,Jp=Ap,Qp=Up.enforce,tg=Up.get,eg=String,ig=Object.defineProperty,ng=Yp("".slice),sg=Yp("".replace),rg=Yp([].join),ag=qp&&!Xp((function(){return 8!==ig((function(){}),"length",{value:8}).length})),og=String(String).split("String"),lg=dp.exports=function(t,e,i){"Symbol("===ng(eg(e),0,7)&&(e="["+sg(eg(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!Kp(t,"name")||Zp&&t.name!==e)&&(qp?ig(t,"name",{value:e,configurable:!0}):t.name=e),ag&&i&&Kp(i,"arity")&&t.length!==i.arity&&ig(t,"length",{value:i.arity});try{i&&Kp(i,"constructor")&&i.constructor?qp&&ig(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=Qp(t);return Kp(n,"source")||(n.source=rg(og,"string"==typeof e?e:"")),t};Function.prototype.toString=lg((function(){return $p(this)&&tg(this).source||Jp(this)}),"toString");var hg=dp.exports,cg=ld,dg=Uu,ug=hg,pg=$d,gg=function(t,e,i,n){n||(n={});var s=n.enumerable,r=void 0!==n.name?n.name:e;if(cg(i)&&ug(i,r,n),n.global)s?t[e]=i:pg(e,i);else{try{n.unsafe?t[e]&&(s=!0):delete t[e]}catch(t){}s?t[e]=i:dg.f(t,e,{value:i,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return t},fg={},vg=Math.ceil,mg=Math.floor,yg=Math.trunc||function(t){var e=+t;return(e>0?mg:vg)(e)},_g=function(t){var e=+t;return e!=e||0===e?0:yg(e)},bg=_g,xg=Math.max,Sg=Math.min,wg=function(t,e){var i=bg(t);return i<0?xg(i+e,0):Sg(i,e)},Ag=_g,kg=Math.min,Mg=function(t){return t>0?kg(Ag(t),9007199254740991):0},Cg=function(t){return Mg(t.length)},Tg=sd,Eg=wg,Pg=Cg,Rg=function(t){return function(e,i,n){var s,r=Tg(e),a=Pg(r),o=Eg(n,a);if(t&&i!=i){for(;a>o;)if((s=r[o++])!=s)return!0}else for(;a>o;o++)if((t||o in r)&&r[o]===i)return t||o||0;return!t&&-1}},Og={includes:Rg(!0),indexOf:Rg(!1)},Bg=ru,Ig=sd,Dg=Og.indexOf,Lg=Rp,Fg=Vc([].push),jg=function(t,e){var i,n=Ig(t),s=0,r=[];for(i in n)!Bg(Lg,i)&&Bg(n,i)&&Fg(r,i);for(;e.length>s;)Bg(n,i=e[s++])&&(~Dg(r,i)||Fg(r,i));return r},zg=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Hg=jg,Ng=zg.concat("length","prototype");fg.f=Object.getOwnPropertyNames||function(t){return Hg(t,Ng)};var Vg={};Vg.f=Object.getOwnPropertySymbols;var Wg=gd,Gg=fg,Ug=Vg,Yg=qu,Xg=Vc([].concat),$g=Wg("Reflect","ownKeys")||function(t){var e=Gg.f(Yg(t)),i=Ug.f;return i?Xg(e,i(t)):e},Kg=ru,qg=$g,Zg=Ac,Jg=Uu,Qg=kc,tf=ld,ef=/#|\.prototype\./,nf=function(t,e){var i=rf[sf(t)];return i==of||i!=af&&(tf(e)?Qg(e):!!e)},sf=nf.normalize=function(t){return String(t).replace(ef,".").toLowerCase()},rf=nf.data={},af=nf.NATIVE="N",of=nf.POLYFILL="P",lf=nf,hf=wc,cf=Ac.f,df=cp,uf=gg,pf=$d,gf=function(t,e,i){for(var n=qg(e),s=Jg.f,r=Zg.f,a=0;ar;r++)if((o=m(t[r]))&&Vv($v,o))return o;return new Xv(!1)}n=Wv(t,s)}for(l=u?t.next:n.next;!(h=Fv(l,n)).done;){try{o=m(h.value)}catch(t){Uv(n,"throw",t)}if("object"==typeof o&&o&&Vv($v,o))return o}return new Xv(!1)},qv=fd,Zv=TypeError,Jv=function(t,e){if(qv(e,t))return t;throw Zv("Incorrect invocation")},Qv=_u("iterator"),tm=!1;try{var em=0,im={next:function(){return{done:!!em++}},return:function(){tm=!0}};im[Qv]=function(){return this},Array.from(im,(function(){throw 2}))}catch(Oo){}var nm=Uu.f,sm=ru,rm=_u("toStringTag"),am=function(t,e,i){t&&!i&&(t=t.prototype),t&&!sm(t,rm)&&nm(t,rm,{configurable:!0,value:e})},om=Vc,lm=Fd,hm=ld,cm=String,dm=TypeError,um=function(t,e,i){try{return om(lm(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}},pm=qu,gm=function(t){if("object"==typeof t||hm(t))return t;throw dm("Can't set "+cm(t)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=um(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return pm(i),gm(n),e?t(i,n):i.__proto__=n,i}}():void 0),vm=ld,mm=dd,ym=fm,_m=vf,bm=wc,xm=Vc,Sm=lf,wm=gg,Am=ev,km=Kv,Mm=Jv,Cm=ld,Tm=Jc,Em=dd,Pm=kc,Rm=function(t,e){if(!e&&!tm)return!1;var i=!1;try{var n={};n[Qv]=function(){return{next:function(){return{done:i=!0}}}},t(n)}catch(t){}return i},Om=am,Bm=function(t,e,i){var n,s;return ym&&vm(n=e.constructor)&&n!==i&&mm(s=n.prototype)&&s!==i.prototype&&ym(t,s),t},Im=function(t,e,i){var n=-1!==t.indexOf("Map"),s=-1!==t.indexOf("Weak"),r=n?"set":"add",a=bm[t],o=a&&a.prototype,l=a,h={},c=function(t){var e=xm(o[t]);wm(o,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return s&&!Em(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(s&&!Em(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(Sm(t,!Cm(a)||!(s||o.forEach&&!Pm((function(){(new a).entries().next()})))))l=i.getConstructor(e,t,n,r),Am.enable();else if(Sm(t,!0)){var d=new l,u=d[r](s?{}:-0,1)!=d,p=Pm((function(){d.has(1)})),g=Rm((function(t){new a(t)})),f=!s&&Pm((function(){for(var t=new a,e=5;e--;)t[r](e,e);return!t.has(-0)}));g||((l=e((function(t,e){Mm(t,o);var i=Bm(new a,t,l);return Tm(e)||km(e,i[r],{that:i,AS_ENTRIES:n}),i}))).prototype=o,o.constructor=l),(p||f)&&(c("delete"),c("has"),n&&c("get")),(f||u)&&c(r),s&&o.clear&&delete o.clear}return h[t]=l,_m({global:!0,constructor:!0,forced:l!=a},h),Om(l,t),s||i.setStrong(l,t,n),l},Dm={},Lm=jg,Fm=zg,jm=Object.keys||function(t){return Lm(t,Fm)},zm=Mc,Hm=Yu,Nm=Uu,Vm=qu,Wm=sd,Gm=jm;Dm.f=zm&&!Hm?Object.defineProperties:function(t,e){Vm(t);for(var i,n=Wm(e),s=Gm(e),r=s.length,a=0;r>a;)Nm.f(t,i=s[a++],n[i]);return t};var Um,Ym=gd("document","documentElement"),Xm=qu,$m=Dm,Km=zg,qm=Rp,Zm=Ym,Jm=Bu,Qm="prototype",ty="script",ey=Pp("IE_PROTO"),iy=function(){},ny=function(t){return"<"+ty+">"+t+""},sy=function(t){t.write(ny("")),t.close();var e=t.parentWindow.Object;return t=null,e},ry=function(){try{Um=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;ry="undefined"!=typeof document?document.domain&&Um?sy(Um):(e=Jm("iframe"),i="java"+ty+":",e.style.display="none",Zm.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(ny("document.F=Object")),t.close(),t.F):sy(Um);for(var n=Km.length;n--;)delete ry[Qm][Km[n]];return ry()};qm[ey]=!0;var ay,oy,ly,hy=Object.create||function(t,e){var i;return null!==t?(iy[Qm]=Xm(t),i=new iy,iy[Qm]=null,i[ey]=t):i=ry(),void 0===e?i:$m.f(i,e)},cy=hg,dy=Uu,uy=function(t,e,i){return i.get&&cy(i.get,e,{getter:!0}),i.set&&cy(i.set,e,{setter:!0}),dy.f(t,e,i)},py=gg,gy=function(t,e,i){for(var n in e)py(t,n,e[n],i);return t},fy=!kc((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),vy=ru,my=ld,yy=iu,_y=fy,by=Pp("IE_PROTO"),xy=Object,Sy=xy.prototype,wy=_y?xy.getPrototypeOf:function(t){var e=yy(t);if(vy(e,by))return e[by];var i=e.constructor;return my(i)&&e instanceof i?i.prototype:e instanceof xy?Sy:null},Ay=kc,ky=ld,My=dd,Cy=wy,Ty=gg,Ey=_u("iterator"),Py=!1;[].keys&&("next"in(ly=[].keys())?(oy=Cy(Cy(ly)))!==Object.prototype&&(ay=oy):Py=!0);var Ry=!My(ay)||Ay((function(){var t={};return ay[Ey].call(t)!==t}));Ry&&(ay={}),ky(ay[Ey])||Ty(ay,Ey,(function(){return this}));var Oy={IteratorPrototype:ay,BUGGY_SAFARI_ITERATORS:Py},By=Oy.IteratorPrototype,Iy=hy,Dy=Fc,Ly=am,Fy=hv,jy=function(){return this},zy=vf,Hy=Pc,Ny=ld,Vy=function(t,e,i,n){var s=e+" Iterator";return t.prototype=Iy(By,{next:Dy(+!n,i)}),Ly(t,s,!1),Fy[s]=jy,t},Wy=wy,Gy=fm,Uy=am,Yy=cp,Xy=gg,$y=hv,Ky=mp.PROPER,qy=mp.CONFIGURABLE,Zy=Oy.IteratorPrototype,Jy=Oy.BUGGY_SAFARI_ITERATORS,Qy=_u("iterator"),t_="keys",e_="values",i_="entries",n_=function(){return this},s_=gd,r_=uy,a_=Mc,o_=_u("species"),l_=hy,h_=uy,c_=gy,d_=lv,u_=Jv,p_=Jc,g_=Kv,f_=function(t,e,i,n,s,r,a){Vy(i,e,n);var o,l,h,c=function(t){if(t===s&&f)return f;if(!Jy&&t in p)return p[t];switch(t){case t_:case e_:case i_:return function(){return new i(this,t)}}return function(){return new i(this)}},d=e+" Iterator",u=!1,p=t.prototype,g=p[Qy]||p["@@iterator"]||s&&p[s],f=!Jy&&g||c(s),v="Array"==e&&p.entries||g;if(v&&(o=Wy(v.call(new t)))!==Object.prototype&&o.next&&(Wy(o)!==Zy&&(Gy?Gy(o,Zy):Ny(o[Qy])||Xy(o,Qy,n_)),Uy(o,d,!0)),Ky&&s==e_&&g&&g.name!==e_&&(qy?Yy(p,"name",e_):(u=!0,f=function(){return Hy(g,this)})),s)if(l={values:c(e_),keys:r?f:c(t_),entries:c(i_)},a)for(h in l)(Jy||u||!(h in p))&&Xy(p,h,l[h]);else zy({target:e,proto:!0,forced:Jy||u},l);return p[Qy]!==f&&Xy(p,Qy,f,{name:s}),$y[e]=f,l},v_=function(t,e){return{value:t,done:e}},m_=function(t){var e=s_(t);a_&&e&&!e[o_]&&r_(e,o_,{configurable:!0,get:function(){return this}})},y_=Mc,__=ev.fastKey,b_=Up.set,x_=Up.getterFor,S_={getConstructor:function(t,e,i,n){var s=t((function(t,s){u_(t,r),b_(t,{type:e,index:l_(null),first:void 0,last:void 0,size:0}),y_||(t.size=0),p_(s)||g_(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=x_(e),o=function(t,e,i){var n,s,r=a(t),o=l(t,e);return o?o.value=i:(r.last=o={index:s=__(e,!0),key:e,value:i,previous:n=r.last,next:void 0,removed:!1},r.first||(r.first=o),n&&(n.next=o),y_?r.size++:t.size++,"F"!==s&&(r.index[s]=o)),t},l=function(t,e){var i,n=a(t),s=__(e);if("F"!==s)return n.index[s];for(i=n.first;i;i=i.next)if(i.key==e)return i};return c_(r,{clear:function(){for(var t=a(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,y_?t.size=0:this.size=0},delete:function(t){var e=this,i=a(e),n=l(e,t);if(n){var s=n.next,r=n.previous;delete i.index[n.index],n.removed=!0,r&&(r.next=s),s&&(s.previous=r),i.first==n&&(i.first=s),i.last==n&&(i.last=r),y_?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=a(this),n=d_(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!l(this,t)}}),c_(r,i?{get:function(t){var e=l(this,t);return e&&e.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),y_&&h_(r,"size",{configurable:!0,get:function(){return a(this).size}}),s},setStrong:function(t,e,i){var n=e+" Iterator",s=x_(e),r=x_(n);f_(t,e,(function(t,e){b_(this,{type:n,target:t,state:s(t),kind:e,last:void 0})}),(function(){for(var t=r(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?v_("keys"==e?i.key:"values"==e?i.value:[i.key,i.value],!1):(t.target=void 0,v_(void 0,!0))}),i?"entries":"values",!i,!0),m_(e)}};Im("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),S_);var w_=Yc,A_=Array.isArray||function(t){return"Array"==w_(t)},k_=Vc,M_=kc,C_=ld,T_=bv,E_=Ap,P_=function(){},R_=[],O_=gd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,I_=k_(B_.exec),D_=!B_.exec(P_),L_=function(t){if(!C_(t))return!1;try{return O_(P_,R_,t),!0}catch(t){return!1}},F_=function(t){if(!C_(t))return!1;switch(T_(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return D_||!!I_(B_,E_(t))}catch(t){return!0}};F_.sham=!0;var j_=!O_||M_((function(){var t;return L_(L_.call)||!L_(Object)||!L_((function(){t=!0}))||t}))?F_:L_,z_=A_,H_=j_,N_=dd,V_=_u("species"),W_=Array,G_=function(t){var e;return z_(t)&&(e=t.constructor,(H_(e)&&(e===W_||z_(e.prototype))||N_(e)&&null===(e=e[V_]))&&(e=void 0)),void 0===e?W_:e},U_=lv,Y_=Zc,X_=iu,$_=Cg,K_=function(t,e){return new(G_(t))(0===e?0:e)},q_=Vc([].push),Z_=function(t){var e=1==t,i=2==t,n=3==t,s=4==t,r=6==t,a=7==t,o=5==t||r;return function(l,h,c,d){for(var u,p,g=X_(l),f=Y_(g),v=U_(h,c),m=$_(f),y=0,_=d||K_,b=e?_(l,m):i||a?_(l,0):void 0;m>y;y++)if((o||y in f)&&(p=v(u=f[y],y,g),t))if(e)b[y]=p;else if(p)switch(t){case 3:return!0;case 5:return u;case 6:return y;case 2:q_(b,u)}else switch(t){case 4:return!1;case 7:q_(b,u)}return r?-1:n||s?s:b}},J_={forEach:Z_(0),map:Z_(1),filter:Z_(2),some:Z_(3),every:Z_(4),find:Z_(5),findIndex:Z_(6),filterReject:Z_(7)},Q_=Vc,tb=gy,eb=ev.getWeakData,ib=Jv,nb=qu,sb=Jc,rb=dd,ab=Kv,ob=ru,lb=Up.set,hb=Up.getterFor,cb=J_.find,db=J_.findIndex,ub=Q_([].splice),pb=0,gb=function(t){return t.frozen||(t.frozen=new fb)},fb=function(){this.entries=[]},vb=function(t,e){return cb(t.entries,(function(t){return t[0]===e}))};fb.prototype={get:function(t){var e=vb(this,t);if(e)return e[1]},has:function(t){return!!vb(this,t)},set:function(t,e){var i=vb(this,t);i?i[1]=e:this.entries.push([t,e])},delete:function(t){var e=db(this.entries,(function(e){return e[0]===t}));return~e&&ub(this.entries,e,1),!!~e}};var mb,yb={getConstructor:function(t,e,i,n){var s=t((function(t,s){ib(t,r),lb(t,{type:e,id:pb++,frozen:void 0}),sb(s)||ab(s,t[n],{that:t,AS_ENTRIES:i})})),r=s.prototype,a=hb(e),o=function(t,e,i){var n=a(t),s=eb(nb(e),!0);return!0===s?gb(n).set(e,i):s[n.id]=i,t};return tb(r,{delete:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).delete(t):i&&ob(i,e.id)&&delete i[e.id]},has:function(t){var e=a(this);if(!rb(t))return!1;var i=eb(t);return!0===i?gb(e).has(t):i&&ob(i,e.id)}}),tb(r,i?{get:function(t){var e=a(this);if(rb(t)){var i=eb(t);return!0===i?gb(e).get(t):i?i[e.id]:void 0}},set:function(t,e){return o(this,t,e)}}:{add:function(t){return o(this,t,!0)}}),s}},_b=zf,bb=wc,xb=Vc,Sb=gy,wb=ev,Ab=Im,kb=yb,Mb=dd,Cb=Up.enforce,Tb=kc,Eb=Cp,Pb=Object,Rb=Array.isArray,Ob=Pb.isExtensible,Bb=Pb.isFrozen,Ib=Pb.isSealed,Db=Pb.freeze,Lb=Pb.seal,Fb={},jb={},zb=!bb.ActiveXObject&&"ActiveXObject"in bb,Hb=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},Nb=Ab("WeakMap",Hb,kb),Vb=Nb.prototype,Wb=xb(Vb.set);if(Eb)if(zb){mb=kb.getConstructor(Hb,"WeakMap",!0),wb.enable();var Gb=xb(Vb.delete),Ub=xb(Vb.has),Yb=xb(Vb.get);Sb(Vb,{delete:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Gb(this,t)||e.frozen.delete(t)}return Gb(this,t)},has:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)||e.frozen.has(t)}return Ub(this,t)},get:function(t){if(Mb(t)&&!Ob(t)){var e=Cb(this);return e.frozen||(e.frozen=new mb),Ub(this,t)?Yb(this,t):e.frozen.get(t)}return Yb(this,t)},set:function(t,e){if(Mb(t)&&!Ob(t)){var i=Cb(this);i.frozen||(i.frozen=new mb),Ub(this,t)?Wb(this,t,e):i.frozen.set(t,e)}else Wb(this,t,e);return this}})}else _b&&Tb((function(){var t=Db([]);return Wb(new Nb,t,1),!Bb(t)}))&&Sb(Vb,{set:function(t,e){var i;return Rb(t)&&(Bb(t)?i=Fb:Ib(t)&&(i=jb)),Wb(this,t,e),i==Fb&&Db(t),i==jb&&Lb(t),this}});var Xb=gd,$b=Vc,Kb=Qd,qb=Xb("Map"),Zb=Xb("WeakMap"),Jb=$b([].push),Qb=Kb("metadata"),tx=Qb.store||(Qb.store=new Zb),ex=function(t,e,i){var n=tx.get(t);if(!n){if(!i)return;tx.set(t,n=new qb)}var s=n.get(e);if(!s){if(!i)return;n.set(e,s=new qb)}return s},ix={store:tx,getMap:ex,has:function(t,e,i){var n=ex(e,i,!1);return void 0!==n&&n.has(t)},get:function(t,e,i){var n=ex(e,i,!1);return void 0===n?void 0:n.get(t)},set:function(t,e,i,n){ex(i,n,!0).set(t,e)},keys:function(t,e){var i=ex(t,e,!1),n=[];return i&&i.forEach((function(t,e){Jb(n,e)})),n},toKey:function(t){return void 0===t||"symbol"==typeof t?t:String(t)}},nx=qu,sx=ix.toKey,rx=ix.set;vf({target:"Reflect",stat:!0},{defineMetadata:function(t,e,i){var n=arguments.length<4?void 0:sx(arguments[3]);rx(t,e,nx(i),n)}});var ax=qu,ox=ix.toKey,lx=ix.getMap,hx=ix.store;vf({target:"Reflect",stat:!0},{deleteMetadata:function(t,e){var i=arguments.length<3?void 0:ox(arguments[2]),n=lx(ax(e),i,!1);if(void 0===n||!n.delete(t))return!1;if(n.size)return!0;var s=hx.get(e);return s.delete(i),!!s.size||hx.delete(e)}});var cx=qu,dx=wy,ux=ix.has,px=ix.get,gx=ix.toKey,fx=function(t,e,i){if(ux(t,e,i))return px(t,e,i);var n=dx(e);return null!==n?fx(t,n,i):void 0};vf({target:"Reflect",stat:!0},{getMetadata:function(t,e){var i=arguments.length<3?void 0:gx(arguments[2]);return fx(t,cx(e),i)}});var vx=Vc,mx=Map.prototype,yx={Map:Map,set:vx(mx.set),get:vx(mx.get),has:vx(mx.has),remove:vx(mx.delete),proto:mx},_x=Pc,bx=Vc,xx=function(t,e,i){for(var n,s,r=i||t.next;!(n=_x(r,t)).done;)if(void 0!==(s=e(n.value)))return s},Sx=yx.Map,Ax=yx.proto,kx=bx(Ax.forEach),Mx=bx(Ax.entries),Cx=Mx(new Sx).next,Tx=Fd,Ex=Jc,Px=Cg,Rx=iu,Ox=function(t,e,i){return i?xx(Mx(t),(function(t){return e(t[1],t[0])}),Cx):kx(t,e)},Bx=yx.Map,Ix=yx.has,Dx=yx.set,Lx=Vc([].push),Fx=vf,jx=Vc,zx=ix,Hx=qu,Nx=wy,Vx=function(t){var e,i,n,s=Rx(this),r=Px(s),a=[],o=new Bx,l=Ex(t)?function(t){return t}:Tx(t);for(e=0;e= than the number of constructor arguments of its base class."},zS=function(t,e){return"@postConstruct error in class "+t+": "+e},HS=function(t,e){return"@preDestroy error in class "+t+": "+e},NS=function(t,e){return"onDeactivation() error in class "+t+": "+e},VS="Maximum call stack size exceeded",WS=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(_S,t),userGeneratedMetadata:Reflect.getMetadata(mS,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(yS,t)||[]},t}(),GS={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};function US(t){return t instanceof RangeError||t.message===VS}function YS(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function XS(t,e,i){var n="",s=i(t,e);return 0!==s.length&&(n="\nRegistered bindings:",s.forEach((function(t){var e="Object";null!==t.implementationType&&(e=qS(t.implementationType)),n=n+"\n "+e,t.constraint.metaData&&(n=n+" - "+t.constraint.metaData)}))),n}function $S(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||$S(t.parentRequest,e))}function KS(t){t.childRequests.forEach((function(t){if($S(t,t.serviceIdentifier)){var e=function(t){var e=function t(e,i){void 0===i&&(i=[]);var n=YS(e.serviceIdentifier);return i.push(n),null!==e.parentRequest?t(e.parentRequest,i):i}(t);return e.reverse().join(" --\x3e ")}(t);throw new Error(LS+" "+e)}KS(t)}))}function qS(t){if(t.name)return t.name;var e=t.toString(),i=e.match(/^function\s*([^\s(]+)/);return i?i[1]:"Anonymous function: "+e}var ZS=function(){function t(t){this.id=CS(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),JS=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===dS?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},t}(),QS=function(t,e){this.parentContext=t,this.rootRequest=e},tw=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}(),ew=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,i=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},i)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),iw=function(){function t(t,e,i,n){this.id=CS(),this.type=t,this.serviceIdentifier=i;var s="symbol"==typeof e?e.toString().slice(7,-1):e;this.name=new ew(s||""),this.identifier=e,this.metadata=new Array;var r=null;"string"==typeof n?r=new JS(dS,n):n instanceof JS&&(r=n),null!==r&&this.metadata.push(r)}return t.prototype.hasTag=function(t){for(var e=0,i=this.metadata;e0,h=o.length>i.length,c=function(t,e,i,n,s){for(var r=[],a=0;a0?a:lw(t,i)}return 0}function hw(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[fS],multiInject:e[vS],targetName:e[uS],unmanaged:e[pS]}}var cw=function(){function t(t,e,i,n,s){this.id=CS(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=i,this.target=s,this.childRequests=[],this.bindings=Array.isArray(n)?n:[n],this.requestScope=null===i?new Map:null}return t.prototype.addChildRequest=function(e,i,n){var s=new t(e,this.parentContext,this,i,n);return this.childRequests.push(s),s},t}();function dw(t){return t._bindingDictionary}function uw(t,e,i,n,s){var r=gw(i.container,s.serviceIdentifier),a=[];return r.length===GS.NoBindingsAvailable&&i.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&t.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(i.container.bind(s.serviceIdentifier).toSelf(),r=gw(i.container,s.serviceIdentifier)),a=e?r:r.filter((function(t){var e=new cw(t.serviceIdentifier,i,n,t,s);return t.constraint(e)})),function(t,e,i,n){switch(e.length){case GS.NoBindingsAvailable:if(i.isOptional())return e;var s=YS(t),r=BS;throw r+=function(t,e){if(e.isTagged()||e.isNamed()){var i="",n=e.getNamedTag(),s=e.getCustomTags();return null!==n&&(i+=n.toString()+"\n"),null!==s&&s.forEach((function(t){i+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+i}return" "+t}(s,i),r+=XS(n,s,gw),new Error(r);case GS.OnlyOneBindingAvailable:return e;case GS.MultipleBindingsAvailable:default:if(i.isArray())return e;s=YS(t),r=OS+" "+s;throw r+=XS(n,s,gw),new Error(r)}}(s.serviceIdentifier,a,s,i.container),a}function pw(t,e,i,n,s,r){var a,o;if(null===s){a=uw(t,e,n,null,r),o=new cw(i,n,null,a,r);var l=new QS(n,o);n.addPlan(l)}else a=uw(t,e,n,s,r),o=s.addChildRequest(r.serviceIdentifier,a,r);a.forEach((function(e){var i=null;if(r.isArray())i=o.addChildRequest(e.serviceIdentifier,e,r);else{if(e.cache)return;i=o}if(e.type===AS.Instance&&null!==e.implementationType){var s=function(t,e){return sw(t,qS(e),e,!1)}(t,e.implementationType);if(!n.container.options.skipBaseClassChecks){var a=lw(t,e.implementationType);if(s.length0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0){var s=function(t,e){return t.reduce((function(t,i){var n=e(i);return i.target.type===kS.ConstructorArgument?t.constructorInjections.push(n):(t.propertyRequests.push(i),t.propertyInjections.push(n)),t.isAsync||(t.isAsync=mw(n)),t}),{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}(e,i),r=Aw(Aw({},s),{constr:t});n=s.isAsync?function(t){return kw(this,void 0,void 0,(function(){var e,i;return Mw(this,(function(n){switch(n.label){case 0:return[4,Pw(t.constructorInjections)];case 1:return e=n.sent(),[4,Pw(t.propertyInjections)];case 2:return i=n.sent(),[2,Ew(Aw(Aw({},t),{constructorInjections:e,propertyInjections:i}))]}}))}))}(r):Ew(r)}else n=new t;return n}function Ew(t){var e,i=new((e=t.constr).bind.apply(e,Cw([void 0],t.constructorInjections,!1)));return t.propertyRequests.forEach((function(e,n){var s=e.target.identifier,r=t.propertyInjections[n];i[s]=r})),i}function Pw(t){return kw(this,void 0,void 0,(function(){var e,i,n,s;return Mw(this,(function(r){for(e=[],i=0,n=t;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?this._map.set(t,e):this._map.delete(t)},t}(),sA=function(){function t(){this._map=new Map}return t.prototype.remove=function(t){if(this._map.has(t)){var e=this._map.get(t);return this._map.delete(t),e}return this._getEmptyHandlersStore()},t.prototype.addDeactivation=function(t,e,i){this._getModuleActivationHandlers(t).onDeactivations.add(e,i)},t.prototype.addActivation=function(t,e,i){this._getModuleActivationHandlers(t).onActivations.add(e,i)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,i){e._map.set(i,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})})),e},t.prototype._getModuleActivationHandlers=function(t){var e=this._map.get(t);return void 0===e&&(e=this._getEmptyHandlersStore(),this._map.set(t,e)),e},t.prototype._getEmptyHandlersStore=function(){return{onActivations:new nA,onDeactivations:new nA}},t}(),rA=function(){return rA=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{let{container:i}=t;return new AA(e,i)})).inSingletonScope().whenTargetNamed(e)}class MA{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 n;if("string"==typeof e)n={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof n.name||""===n.name)throw new Error("Missing name for tap");return n=Object.assign({type:t,fn:i},n),n}_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 n=this.taps.length;for(;n>0;){n--;const t=this.taps[n];this.taps[n+1]=t;const s=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(s>i)){n++;break}}this.taps[n]=t}}class CA extends MA{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const TA=Symbol.for("EnvContribution"),EA=Symbol.for("VGlobal");var PA=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},OA=function(t,e){return function(i,n){e(i,n,t)}};let BA=class{get env(){return this._env}get devicePixelRatio(){return this._env||this.setEnv("browser"),this.envContribution.getDevicePixelRatio()}get supportEvent(){return this._env||this.setEnv("browser"),this.envContribution.supportEvent}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}constructor(t){this.contributions=t,this.hooks={onSetEnv:new CA(["lastEnv","env","global"])},this.measureTextMethod="native"}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const n=i.configure(this,t);n&&n.then&&e.push(n)})),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 n=this.bindContribution(e);if(n&&n.then)return n.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return this._env||this.setEnv("browser"),"browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1}isSafari(){return this._env||this.setEnv("browser"),"browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)}};BA=PA([fA(),OA(0,yA(wA)),OA(0,vA(TA)),RA("design:paramtypes",[Object])],BA);const IA=Ct-1e-8;class DA{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,n,s,r){if(Math.abs(s-n)>IA)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(n),g(s),s!==n)if((n%=Ct)<0&&(n+=Ct),(s%=Ct)<0&&(s+=Ct),ss;++o,a-=Mt)g(a);else for(a=n-n%Mt+Mt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const FA=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jA={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},zA={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let HA,NA,VA,WA,GA,UA;var YA,XA,$A,KA,qA,ZA,JA,QA,tk;function ek(t){const e=t[0],i=t[1],n=t[2],s=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(n),g=Math.sin(n),f=Math.cos(s),v=Math.sin(s),m=.5*(s-n),y=Math.sin(.5*m),_=8/3*y*y/Math.sin(m),b=e+p-_*g,x=i+g+_*p,S=e+f,w=i+v,A=S+_*v,k=w-_*f;return[h*b+c*x,d*b+u*x,h*A+c*k,d*A+u*k,h*S+c*w,d*S+u*w]}function ik(t,e,i,n){const s=function(t,e,i,n,s,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((n=Math.abs(n))*n);g>1&&(g=Math.sqrt(g),i*=g,n*=g);const f=d/i,v=c/i,m=-c/n,y=d/n,_=f*o+v*l,b=m*o+y*l,x=f*t+v*e,S=m*t+y*e;let w=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;w<0&&(w=0);let A=Math.sqrt(w);r===s&&(A=-A);const k=.5*(_+x)-A*(S-b),M=.5*(b+S)+A*(x-_),C=Math.atan2(b-M,_-k);let T=Math.atan2(S-M,x-k)-C;T<0&&1===r?T+=Ct:T>0&&0===r&&(T-=Ct);const E=Math.ceil(Math.abs(T/(Mt+.001))),P=[];for(let t=0;t{const o=Math.abs(i-e),l=4*Math.tan(o/4)/3,h=ie.arc(t[1]*s+i,t[2]*r+n,t[3]*(s+r)/2,t[4],t[5],t[6],a),(t,e,i,n,s,r,a)=>e.arcTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*(s+r)/2,a),(t,e,i,n,s,r,a)=>e.bezierCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,t[5]*s+i,t[6]*r+n,a),(t,e,i,n)=>e.closePath(),(t,e,i,n,s,r)=>e.ellipse(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,n,s,r,a)=>e.lineTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.moveTo(t[1]*s+i,t[2]*r+n,a),(t,e,i,n,s,r,a)=>e.quadraticCurveTo(t[1]*s+i,t[2]*r+n,t[3]*s+i,t[4]*r+n,a),(t,e,i,n,s,r,a)=>e.rect(t[1]*s+i,t[2]*r+n,t[3]*s,t[4]*r,a)];function rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class fk extends gk{bezierCurveTo(t,e,i,n,s,r,a,o){return super.bezierCurveTo(e,t,n,i,r,s,a,o)}lineTo(t,e,i,n){return super.lineTo(e,t,i,n)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function vk(t,e){let i=!1;for(let n=0,s=e.length;n<=s;n++)n>=s===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[n])}class mk{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 yk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new mk(s,n),t),s}function _k(t,e,i,n,s){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,n,t.lastPoint1)}class bk{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&&_k(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:_k(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 xk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("basis",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new bk(s,n),t),s}function Sk(t){return t<0?-1:1}function wk(t,e,i){const n=t._x1-t._x0,s=e-t._x1,r=(t._y1-t._y0)/(n||Number(s<0&&-0)),a=(i-t._y1)/(s||Number(n<0&&-0)),o=(r*s+a*n)/(n+s);return(Sk(r)+Sk(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ak(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function kk(t,e,i,n,s){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,n,t.lastPoint1)}class Mk{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._lastDefined2,this.lastPoint1);break;case 3:kk(this,this._t0,Ak(this,this._t0),!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,n=t.y;if(i!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,n,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,n,t);break;case 1:this._point=2;break;case 2:this._point=3,kk(this,Ak(this,e=wk(this,i,n)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:kk(this,this._t0,e=wk(this,i,n),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=n,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 Ck extends Mk{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new gk("monotoneX",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Mk(s,n),t),s}function Ek(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;if(t.length<3-Number(!!n))return yk(t,e);const s=new fk("monotoneY",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ck(s,n),t),s}let Pk=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const n=this._x*(1-this._t)+e*this._t;this.context.lineTo(n,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(n,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Rk(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:n,startPoint:s}=i;if(t.length<2-Number(!!s))return null;const r=new gk("step",null!=n?n:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Pk(r,e,s),t),r}class Ok{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.context.closePath()}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 Bk(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:n}=e;if(t.length<2-Number(!!n))return null;const s=new gk("linear",null!=i?i:Et(t[t.length-1].x-t[0].x)>Et(t[t.length-1].y-t[0].y)?JA.ROW:JA.COLUMN);return function(t,e){vk(t,e)}(new Ok(s,n),t),s}function Ik(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}class Dk extends LA{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new DA(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([zA.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([zA.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.commandList.push([zA.Q,t,e,i,n]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.commandList.push([zA.C,t,e,i,n,s,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,s,r),this}arcTo(t,e,i,n,s){return this.commandList.push([zA.AT,t,e,i,n,s]),this._ctx&&this._ctx.arcTo(t,e,i,n,s),this}ellipse(t,e,i,n,s,r,a,o){return this.commandList.push([zA.E,t,e,i,n,s,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,n,s,r,a,o),this}rect(t,e,i,n){return this.commandList.push([zA.R,t,e,i,n]),this._ctx&&this._ctx.rect(t,e,i,n),this}arc(t,e,i,n,s,r){return this.commandList.push([zA.A,t,e,i,n,s,r]),this._ctx&&this._ctx.arc(t,e,i,n,s,r),this}closePath(){return this.commandList.push([zA.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}toString(){if(!this.toStringCbList){const t=[];t[zA.M]=t=>`M${t[1]} ${t[2]}`,t[zA.L]=t=>`L${t[1]} ${t[2]}`,t[zA.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[zA.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[zA.A]=t=>{const e=[];nk(e,t[4],t[5],t[1],t[2],t[3],t[3]);let i="";for(let t=0;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,n,s){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,n;const s=[];for(let t=0,r=e.length;tUA){let t;for(let e=1,n=i.length;e{this.transformCbList[s[0]](s,t,e,i,n)})),this._updateBounds()}moveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}lineToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i}quadraticCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i}bezierCurveToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*n+e,t[6]=t[6]*s+i}arcToTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n+e,t[4]=t[4]*s+i,t[5]=t[5]*(n+s)/2}ellipseTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}rectTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*n,t[4]=t[4]*s}arcTransform(t,e,i,n,s){t[1]=t[1]*n+e,t[2]=t[2]*s+i,t[3]=t[3]*(n+s)/2}closePathTransform(){}_runCommandStrList(t){let e,i,n,s,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,v=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==n||1!==s)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),rk(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===JA.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.y-e.p1.y)}if(this.direction===JA.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Et(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let n=0;n=t)break;i+=s}const n=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(n),angle:e.getAngleAt(n)}}}const Lk=["l",0,0,0,0,0,0,0];function Fk(t,e,i){const n=Lk[0]=t[0];if("a"===n||"A"===n)Lk[1]=e*t[1],Lk[2]=i*t[2],Lk[3]=t[3],Lk[4]=t[4],Lk[5]=t[5],Lk[6]=e*t[6],Lk[7]=i*t[7];else if("h"===n||"H"===n)Lk[1]=e*t[1];else if("v"===n||"V"===n)Lk[1]=i*t[1];else for(let n=1,s=t.length;n{console.warn("空函数")}}),Qk=Object.assign(Object.assign({},Uk),{points:[],cornerRadius:0}),tM=Object.assign(Object.assign({},Uk),{width:0,height:0,strokeBoundsBuffer:0,cornerRadius:0}),eM=Object.assign(Object.assign({},Uk),{width:0,height:0,cornerRadius:0,length:0}),iM=Object.assign(Object.assign({},Uk),{symbolType:"circle",size:10,keepDirIn3d:!0}),nM=Object.assign(Object.assign(Object.assign({},Uk),Vk),{strokeBoundsBuffer:0,keepDirIn3d:!0}),sM=Object.assign(Object.assign({},Uk),{width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],maxHeight:void 0,maxWidth:void 0,singleLine:!1}),rM=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},Uk),{fill:!0}),aM=Object.assign(Object.assign({},rM),{backgroundShowMode:"never",backgroundWidth:0,backgroundHeight:0,textAlign:"left",textBaseline:"middle",direction:"horizontal",margin:0,id:"",width:20,height:20,backgroundFill:"rgba(101, 117, 168, 0.1)",backgroundFillOpacity:1,backgroundStroke:!1,backgroundStrokeOpacity:1,backgroundRadius:4,opacity:1});const oM=new class{},lM={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"}},hM=!0,cM=!1,dM=/\w|\(|\)/,uM=/[.?!,;:/,。?!、;:]/,pM=/\S/;function gM(t,e,i,n,s){if(!e||e<=0)return 0;const r=oM.graphicUtil.textMeasure;let a=n,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 s&&(a=fM(t,a)),a}function fM(t,e){let i=e;for(;dM.test(t[i-1])&&dM.test(t[i])||uM.test(t[i]);)if(i--,i<=0)return e;return i}function vM(t,e){const i=oM.graphicUtil.textMeasure.measureText(t,e),n={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(n.width=Math.floor(i.width),n.height=e.fontSize||0,n.ascent=n.height,n.descent=0):(n.width=Math.floor(i.width),n.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),n.ascent=Math.floor(i.actualBoundingBoxAscent),n.descent=n.height-n.ascent),n}var mM=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yM=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=nM.fontSize}=e,n=0,s=0;for(let e=0;e{t.width=0===t.direction?s:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const s=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1);if(n&&s.str!==t[o].text){let i="",n=0;for(let e=0;ei)return{str:"",width:0};const r=this._clipText(t,e,i,0,t.length-1);if(n&&r.str!==t){const i=fM(t,r.str.length);i!==r.str.length&&(r.str=t.substring(0,i),r.width=this.measureTextWidth(r.str,e))}return r}_clipText(t,e,i,n,s){const r=Math.floor((n+s)/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 s=t.substring(0,r);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipText(t,e,i,n,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const n=t.substring(0,r+2);return l=this.measureTextWidth(n,e),l>=i?{str:a,width:o}:this._clipText(t,e,i,r,s)}return{str:a,width:o}}clipTextWithSuffixVertical(t,e,i,n,s){if(""===n)return this.clipTextVertical(t,e,i,s);if(0===t.length)return{verticalList:t,width:0};const r=this.clipTextVertical(t,e,i,s);if(r.verticalList.length===t.length&&r.verticalList[r.verticalList.length-1].width===t[t.length-1].width)return r;const a=this.measureTextWidth(n,e);if(a>i)return r;i-=a;const o=this.clipTextVertical(t,e,i,s);return o.width+=a,o.verticalList.push({text:n,direction:1,width:a}),o}clipTextWithSuffix(t,e,i,n,s){if(""===n)return this.clipText(t,e,i,s);if(0===t.length)return{str:"",width:0};const r=this.measureTextWidth(t,e);if(r<=i)return{str:t,width:r};const a=this.measureTextWidth(n,e);if(a>i)return{str:"",width:0};i-=a;const o=this._clipText(t,e,i,0,t.length-1);if(s&&o.str!==t){const i=fM(t,o.str.length);i!==o.str.length&&(o.str=t.substring(0,i),o.width=this.measureTextWidth(o.str,e))}return o.str+=n,o.width+=a,o}};yM=mM([fA()],yM);var _M=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const bM=Symbol.for("TextMeasureContribution");let xM=class extends yM{};xM=_M([fA()],xM);const SM=new hA,wM=Symbol.for("CanvasFactory"),AM=Symbol.for("Context2dFactory");function kM(t){return SM.getNamed(wM,oM.global.env)(t)}const MM=1e-4,CM=Math.sqrt(3),TM=1/3;function EM(t){return t>-WM&&tWM||t<-WM}const RM=[0,0],OM=[0,0],BM=[0,0];function IM(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function DM(t,e,i,n){const s=1-n;return s*(s*t+2*n*e)+n*n*i}function LM(t,e,i,n,s){const r=1-s;return r*r*(r*t+3*s*e)+s*s*(s*n+3*r*i)}function FM(t){return(t%=Tt)<0&&(t+=Tt),t}function jM(t,e,i,n,s,r){if(r>e&&r>n||rs?o:0}function zM(t,e,i,n,s,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>n+h&&l>r+h||lt+h&&o>i+h&&o>s+h||o=0&&le+d&&c>n+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>s+d&&h>a+d||h=0&&pi||c+hs&&(s+=Tt);let d=Math.atan2(l,o);return d<0&&(d+=Tt),d>=n&&d<=s||d+Tt>=n&&d+Tt<=s}function VM(t,e,i,n,s,r,a){if(0===s)return!1;const o=s,l=s/2;let h=0,c=t;if(a>e+l&&a>n+l||at+l&&r>i+l||r=0&&t<=1&&(s[l++]=t)}}else{const t=r*r-4*a*o;if(EM(t))s[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),n=(-r-e)/(2*a);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}const UM=[-1,-1,-1],YM=[-1,-1];function XM(){const t=YM[0];YM[0]=YM[1],YM[1]=t}function $M(t,e,i,n,s,r,a,o,l,h){if(h>e&&h>n&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(EM(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),n=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,TM):Math.pow(i,TM),n=n<0?-Math.pow(-n,TM):Math.pow(n,TM);const s=(-o-(i+n))/(3*a);s>=0&&s<=1&&(r[p++]=s)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),n=Math.cos(e),s=(-o-2*i*n)/(3*a),l=(-o+i*(n+CM*Math.sin(e)))/(3*a),h=(-o+i*(n-CM*Math.sin(e)))/(3*a);s>=0&&s<=1&&(r[p++]=s),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,n,r,o,h,UM);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&XM(),p=LM(e,n,r,o,YM[0]),u>1&&(g=LM(e,n,r,o,YM[1]))),2===u?ce&&o>n&&o>r||o=0&&t<=1&&(s[l++]=t)}}else{const t=a*a-4*r*o;if(EM(t)){const t=-a/(2*r);t>=0&&t<=1&&(s[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),n=(-a-e)/(2*r);i>=0&&i<=1&&(s[l++]=i),n>=0&&n<=1&&(s[l++]=n)}}return l}(e,n,r,o,UM);if(0===l)return 0;const h=function(t,e,i){const n=t+i-2*e;return 0===n?.5:(t-e)/n}(e,n,r);if(h>=0&&h<=1){let o=0;const c=DM(e,n,r,h);for(let n=0;ni||o<-i)return 0;const l=Math.sqrt(i*i-o*o);UM[0]=-l,UM[1]=l;const h=Math.abs(n-s);if(h<1e-4)return 0;if(h>=Tt-1e-4){n=0,s=Tt;const e=r?1:-1;return a>=UM[0]+t&&a<=UM[1]+t?e:0}if(n>s){const t=n;n=s,s=t}n<0&&(n+=Tt,s+=Tt);let c=0;for(let e=0;e<2;e++){const i=UM[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Tt+t),(t>=n&&t<=s||t+Tt>=n&&t+Tt<=s)&&(t>kt/2&&t<1.5*kt&&(e=-e),c+=e)}}return c}function ZM(t){return Math.round(t/kt*1e8)/1e8%2*kt}function JM(t,e){let i=ZM(t[0]);i<0&&(i+=Tt);const n=i-t[0];let s=t[1];s+=n,!e&&s-i>=Tt?s=i+Tt:e&&i-s>=Tt?s=i-Tt:!e&&i>s?s=i+(Tt-ZM(i-s)):e&&i1&&(i||(h+=jM(c,d,u,p,n,s))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],v=a[1],m=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,w=b;QM[0]=S,QM[1]=w,JM(QM,Boolean(a[6])),S=QM[0],w=QM[1];const A=S,k=w-S,M=!!(1-(a[6]?0:1)),C=(n-v)*y/y+v;switch(f){case zA.M:u=v,p=m,c=u,d=p;break;case zA.L:if(i){if(VM(c,d,v,m,e,n,s))return!0}else h+=jM(c,d,v,m,n,s)||0;c=v,d=m;break;case zA.C:if(i){if(HM(c,d,v,m,y,_,b,x,e,n,s))return!0}else h+=$M(c,d,v,m,y,_,b,x,n,s)||0;c=b,d=x;break;case zA.Q:if(i){if(zM(c,d,v,m,y,_,e,n,s))return!0}else h+=KM(c,d,v,m,y,_,n,s)||0;c=y,d=_;break;case zA.A:if(o=Math.cos(A)*y+v,l=Math.sin(A)*y+m,g?(u=o,p=l):h+=jM(c,d,o,l,n,s),i){if(NM(v,m,y,A,A+k,M,e,C,s))return!0}else h+=qM(v,m,y,A,A+k,M,C,s);c=Math.cos(A+k)*y+v,d=Math.sin(A+k)*y+m;break;case zA.R:if(u=c=v,p=d=m,o=u+y,l=p+_,i){if(VM(u,p,o,p,e,n,s)||VM(o,p,o,l,e,n,s)||VM(o,l,u,l,e,n,s)||VM(u,l,u,p,e,n,s))return!0}else h+=jM(o,p,o,l,n,s),h+=jM(u,l,u,p,n,s);break;case zA.Z:if(i){if(VM(c,d,u,p,e,n,s))return!0}else h+=jM(c,d,u,p,n,s);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iC=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nC=function(t,e){return function(i,n){e(i,n,t)}};let sC=class{constructor(t,e){this.contributions=t,this.global=e,this.configured=!1,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){if(this.configured)return;const i=kM({nativeCanvas:t.createCanvas({width:100,height:100})});this.canvas=i,this.context=i.getContext("2d"),this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var n;this.configure(this.global,this.global.env);const s=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(n=e.fontSize)&&void 0!==n?n:Vk.fontSize};return this.global.measureTextMethod=s,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Ye(Object.assign({defaultFontParams:{fontFamily:Vk.fontFamily,fontSize:Vk.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}};var rC;sC=eC([fA(),nC(0,yA(wA)),nC(0,vA(bM)),nC(1,yA(EA)),iC("design:paramtypes",[Object,Object])],sC),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(rC||(rC={}));const aC=new ee;let oC=class{constructor(){this.matrix=new ee}init(t){return this.mode=rC.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=rC.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const n=this.outSourceMatrix;if(aC.setValue(n.a,n.b,n.c,n.d,n.e,n.f),this.outTargetMatrix.reset(),i){const{x:n,y:s}=i;this.outTargetMatrix.translate(n,s),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-n,-s)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}scale(t,e,i){return this.mode===rC.matrix?this.scaleMatrix(t,e,i):this}translateMatrix(t,e){const i=this.outSourceMatrix;return aC.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(aC.a,aC.b,aC.c,aC.d,aC.e,aC.f),this}translate(t,e){return this.mode===rC.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===rC.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};oC=eC([fA(),iC("design:paramtypes",[])],oC);const lC={arc:Yk,area:Xk,circle:$k,line:Zk,path:Jk,symbol:iM,text:nM,rect:tM,rect3d:eM,polygon:Qk,richtext:sM,richtextIcon:aM,image:rM,group:Kk,glyph:qk},hC=Object.keys(lC);function cC(){return{arc:Object.assign({},lC.arc),area:Object.assign({},lC.area),circle:Object.assign({},lC.circle),line:Object.assign({},lC.line),path:Object.assign({},lC.path),symbol:Object.assign({},lC.symbol),text:Object.assign({},lC.text),rect:Object.assign({},lC.rect),rect3d:Object.assign({},lC.rect3d),polygon:Object.assign({},lC.polygon),richtext:Object.assign({},lC.richtext),richtextIcon:Object.assign({},lC.richtextIcon),image:Object.assign({},lC.image),group:Object.assign({},lC.group),glyph:Object.assign({},lC.glyph)}}function dC(t,e){e&&(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Object.keys(e).forEach((i=>{t[i]?Object.assign(t[i],e[i]):t[i]=e[i]})):Object.keys(e).forEach((i=>{if(t[i]){const n=t[i],s=e[i];Object.keys(e[i]).forEach((t=>{void 0===n[t]&&(n[t]=s[t])}))}else t[i]=e[i]})))}const uC=new Array(60).fill(0).map((()=>cC()));class pC{constructor(){this._defaultTheme=uC.pop()||cC(),this.combinedTheme=this._defaultTheme,this.dirty=!1}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const n=this.getParentWithTheme(t);if(n){const t=n.theme;(t.dirty||i)&&t.applyTheme(n,e,!0),this.userTheme?dC(this.userTheme,t.userTheme,!1):this.userTheme=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;const s=[],r=[];return void 0===e&&(e=!0),void 0===i&&(i=1/0),function t(i,a){if(null===i)return null;if(0===a)return i;let o;if("object"!=typeof i)return i;if(f(i)?o=[]:x(i)?(o=new RegExp(i.source,function(t){let e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}(i)),i.lastIndex&&(o.lastIndex=i.lastIndex)):o=m(i)?new Date(i.getTime()):void 0===n?Object.create(Object.getPrototypeOf(i)):Object.create(n),e){const t=s.indexOf(i);if(-1!==t)return r[t];s.push(i),r.push(o)}for(const e in i)o[e]=t(i[e],a-1);return o}(t,i)}(t.userTheme),dC(e,t.userTheme)}this.userTheme?this.doCombine(e):(n?this.combinedTheme=n.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,console.warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this._defaultTheme,n=this.combinedTheme,s=t.common||{},r=Object.assign(s,this.commonTheme);hC.forEach((s=>{var a,o;e[s]||r||t[s]?n[s]=Object.assign({},i[s],null!=r?r:{},null!==(a=t[s])&&void 0!==a?a:{},null!==(o=e[s])&&void 0!==o?o:{}):n[s]=i[s]})),this.dirty=!1}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}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,t.common&&(this.commonTheme?Object.assign(this.commonTheme,t.common):this.commonTheme=t.common),this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const gC=new pC;function fC(t,e){return t.glyphHost?fC(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)):gC.getTheme()}return null}(t)||gC.getTheme()}class vC{static GenAutoIncrementId(){return vC.auto_increment_id++}}vC.auto_increment_id=0;var mC=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class yC extends s{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=vC.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return mC(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let n=t(e,i++);if(n.then&&(n=yield n),n)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const n=this.insertInto(t,0);return this._ignoreWarn=!1,n}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(){if(!this._idMap)return;let t=this._firstChild;for(;t;)t.parent=null,t._prev=null,t._next=null,t=t._next;this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,n)=>!(e===this||!t(e,n)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.find(t,!0);if(n)return i=n,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,n)=>{e!==this&&t(e,n)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const n=e.findAll(t,!0);n.length&&(i=i.concat(n))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),n=1;n{if(!(t instanceof xC))return void console.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(kC(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,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.createPointerEvent(t,t.type,e),r=kC(s.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==s.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"),!s.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!s.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!==s.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(s,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let n=null==o?void 0:o.parent;for(;n&&n!==this.rootTarget.parent&&n!==s.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(s,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==o&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(s,"pointermove"),"touch"===s.pointerType&&this.dispatchEvent(s,"touchmove"),r&&(this.dispatchEvent(s,"mousemove"),this.cursor=(null===(n=null===(i=s.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.cursor)||this.rootTarget.getCursor()),a.overTargets=s.composedPath(),this.freeEvent(s)},this.onPointerOver=(t,e)=>{var i,n;if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=kC(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursor=(null===(n=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===n?void 0:n.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;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=kC(t.pointerType),n=this.findMountedTarget(i.overTargets),s=this.createPointerEvent(t,"pointerout",n||void 0);this.dispatchEvent(s),e&&this.dispatchEvent(s,"mouseout");const r=this.createPointerEvent(t,"pointerleave",n||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(s),this.freeEvent(r)}this.cursor=""},this.onPointerUp=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=AC.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(kC(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),r=this.findMountedTarget(s.pressTargetsByButton[t.button]);let a=r;if(r&&!n.composedPath().includes(r)){let e=r;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(kC(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete s.pressTargetsByButton[t.button],a=e}if(a){const e=this.clonePointerEvent(n,"click");e.target=a,e.path=[],s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:i});const r=s.clicksByButton[t.button];r.target===e.target&&i-r.timeStamp<200?++r.clickCount:r.clickCount=1,r.target=e.target,r.timeStamp=i,e.detail=r.clickCount,kC(e.pointerType)?(this.dispatchEvent(e,"click"),2===r.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this.dispatchEvent(e,"tap"),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof xC))return void console.warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]),s=this.createPointerEvent(t,t.type,e);if(n){let e=n;for(;e;)s.currentTarget=e,this.notifyTarget(s,"pointerupoutside"),"touch"===s.pointerType?this.notifyTarget(s,"touchendoutside"):kC(s.pointerType)&&this.notifyTarget(s,2===s.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(s)},this.onWheel=(t,e)=>{if(!(t instanceof SC))return void console.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.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,n,s,r;if(!this.rootTarget)return;const a=this.mappingTable[t.type];let o;const l=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[l])&&(null===(n=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[l])||void 0===n?void 0:n.stage.renderCount)===(null===(s=this._prePointTargetCache)||void 0===s?void 0:s.stageRenderCount)?o=this._prePointTargetCache[l]:(o=this.pickTarget(t.canvasX,t.canvasY),this._prePointTargetCache={[l]:o,stageRenderCount:null!==(r=null==o?void 0:o.stage.renderCount)&&void 0!==r?r:-1}),a)for(let e=0,i=a.length;e=0;n--)if(t.currentTarget=i[n],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){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=0&&t<=T(this.rootTarget,"width")&&e>=0&&e<=T(this.rootTarget,"height")?this.rootTarget:null,i}}const CC={pickable:!0,visible:!0,dispatchEvent(t){var e;if(!(t instanceof _C))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=[],t.target=this,null===(e=null==t?void 0:t.manager)||void 0===e||e.dispatchEvent(t),!t.defaultPrevented},emit(t,e){return this.dispatchEvent(new wC(t,e))}},TC={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};class EC{constructor(t){this.resolution=1,this.onPointerDown=t=>{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.isEventOutsideOfTargetElement(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,n=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:n,global:s,viewport:r,autoPreventDefault:a=!1}=t;this.manager=new MC(n),this.globalObj=s,this.supportsPointerEvents=s.supportsPointerEvents,this.supportsTouchEvents=s.supportsTouchEvents,this.supportsMouseEvents=s.supportsMouseEvents,this.applyStyles=s.applyStyles,this.autoPreventDefault=a,this.eventsAdded=!1,this.viewport=r,this.rootPointerEvent=new xC,this.rootWheelEvent=new SC,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.setTargetElement(null)}setCursor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";const{applyStyles:e,domElement:i}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&e?i.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&e&&Object.assign(i.style,n):e&&g(t)&&!P(this.cursorStyles,t)&&(i.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){const e=this.viewport,{x:i,y:n}=t;return{x:i-e.x,y:n-e.y}}mapToCanvasPoint(t){var e;const i=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(i)return i;const{clientX:n,clientY:s}=t,r=this.domElement.getBoundingClientRect();return{x:n-r.left,y:s-r.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,n=t.changedTouches.length;i0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}}class PC{constructor(t){this.onPointerDown=t=>{const e=t.target,i=this.rootNode,n=e===i;if(e&&!n){let s,r=!1;function a(t){if(r||(t.type="dragstart",null==e||e.dispatchEvent(t),r=!0),t.type="drag",null==e||e.dispatchEvent(t),!n){e.pickable=!1;const n=(null==i?void 0:i.pick(t.global.x,t.global.y)).graphic;e.pickable=!0,s!==n&&(s&&(t.type="dragleave",t.target=s,s.dispatchEvent(t)),n&&(t.type="dragenter",t.target=n,n.dispatchEvent(t)),s=n,s&&(t.type="dragover",t.target=s,s.dispatchEvent(t)))}}null==i||i.addEventListener("pointermove",a);const o=function(){r&&(s&&(t.type="drop",t.target=s,s.dispatchEvent(t)),t.type="dragend",e.dispatchEvent(t),r=!1),null==i||i.removeEventListener("pointermove",a)};e.addEventListener("pointerup",o,{once:!0}),e.addEventListener("pointerupoutside",o,{once:!0})}},this.rootNode=t,this.initEvents()}initEvents(){var t;null===(t=this.rootNode)||void 0===t||t.addEventListener("pointerdown",this.onPointerDown)}removeEvents(){var t;null===(t=this.rootNode)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown)}release(){this.removeEvents(),this.rootNode=null}}const RC=(t,e)=>{const i=e.x-t.x,n=e.y-t.y;return Math.abs(i)>Math.abs(n)?i>0?"right":"left":n>0?"down":"up"},OC=(t,e)=>{const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);return Math.sqrt(i*i+n*n)};class BC extends s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,n,s,r,a,o,l,h;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.onStart=t=>{this.reset(),this.startTime=AC.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,n=0,s=0;for(;s{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.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const n=t.clone(),{x:s,y:r,pointerId:a}=n;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=AC.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=s-t.x,a=r-t.y,h=this.direction||RC(t,o);this.direction=h;const c=this.getEventType(o);return n.direction=h,n.deltaX=i,n.deltaY=a,n.points=l,this.triggerStartEvent(c,n),void this.triggerEvent(c,n)}const{startDistance:c}=this,d=OC(l[0],l[1]);n.scale=d/c,n.center=this.center,n.points=l,this.triggerStartEvent("pinch",n),this.triggerEvent("pinch",n)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:n}=this,s=i.map((t=>({x:t.x,y:t.y})));if(e.points=s,this.triggerEndEvent(e),1===i.length){const t=AC.now(),i=this.lastMoveTime;if(t-i<100){const t=i-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||n[0],s=this.lastMovePoint||n[0],r=OC(i,s),a=r/t;a>this.config.swipe.velocity&&r>this.config.swipe.threshold&&(e.velocity=a,e.direction=RC(i,s),this.triggerEvent("swipe",e))}}}for(let t=0,s=i.length;t0&&this.onStart()},this.element=t,this.config={press:{time:null!==(n=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==n?n:251,threshold:null!==(r=null===(s=null==e?void 0:e.press)||void 0===s?void 0:s.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}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:n}=this;if(e)return e;let s;return s=AC.now()-i>this.config.press.time&&OC(n[0],t){for(let t=0,e=n.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let n=0,s=i.length;n0&&(this.timerId=-1)}getTime(){return this.time}}class DC{static Avaliable(){return!0}avaliable(){return DC.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class LC{static Avaliable(){return!!oM.global.getRequestAnimationFrame()}avaliable(){return LC.Avaliable()}tick(t,e){oM.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}var FC;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(FC||(FC={}));class jC{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-jC.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*jC.bounceIn(2*t):.5*jC.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const n=e/Tt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-n)*Tt/e)+1}}static getElasticInOut(t,e){return function(i){const n=e/Tt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-n)*Tt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-n)*Tt/e)*.5+1}}}jC.quadIn=jC.getPowIn(2),jC.quadOut=jC.getPowOut(2),jC.quadInOut=jC.getPowInOut(2),jC.cubicIn=jC.getPowIn(3),jC.cubicOut=jC.getPowOut(3),jC.cubicInOut=jC.getPowInOut(3),jC.quartIn=jC.getPowIn(4),jC.quartOut=jC.getPowOut(4),jC.quartInOut=jC.getPowInOut(4),jC.quintIn=jC.getPowIn(5),jC.quintOut=jC.getPowOut(5),jC.quintInOut=jC.getPowInOut(5),jC.backIn=jC.getBackIn(1.7),jC.backOut=jC.getBackOut(1.7),jC.backInOut=jC.getBackInOut(1.7),jC.elasticIn=jC.getElasticIn(1,.3),jC.elasticOut=jC.getElasticOut(1,.3),jC.elasticInOut=jC.getElasticInOut(1,.3*1.5);const zC=new class{constructor(){this.id=vC.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===KA.END?this.removeAnimate(e):e.status===KA.RUNNING||e.status===KA.INITIAL?(this.animateCount++,e.advance(t)):e.status===KA.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),t.release()}};class HC{constructor(t,e,i,n,s){this.from=t,this.to=e,this.duration=i,this.easing=n,this.params=s,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){0===this.updateCount&&this.onFirstRun(),this.updateCount+=1,Object.assign(i,this.step.getLastProps()),this.onUpdate(t,e,i),t&&this.onEnd()}}class NC extends HC{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}let VC=class t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:vC.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zC;this.id=t,this.timeline=e,this.status=KA.INITIAL,this.tailAnimate=new WC(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this)}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Ot(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(e,i){t.interpolateMap.set(e,i)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.duration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.mode;e&&i&qA.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(e,!1,{type:$A.ANIMATE_PLAY})}runCb(t){const e=new NC((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(e,i,n,s,r,a){const o=t.interpolateMap.get(e)||t.interpolateMap.get("");return!!o&&o(e,i,n,s,r,a)}pause(){this.status===KA.RUNNING&&(this.status=KA.PAUSED)}resume(){this.status===KA.PAUSED&&(this.status=KA.RUNNING)}to(t,e,i,n){if(this.tailAnimate.to(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,n){if(this.tailAnimate.from(t,e,i,n),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new WC(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(this.rawPosition+t*this.timeScale)&&this.status===KA.RUNNING&&(this.status=KA.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const n=this.rawPosition,s=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=s;if(r&&(t=s),t===n)return r;for(let n=0;n=t));n++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=KA.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}};VC.mode=qA.NORMAL,VC.interpolateMap=new Map;class WC{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new GC(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,n="string"==typeof i?jC[i]:i,s=this._addStep(e,null,n);return s.type=ZA.customAnimate,this._appendProps(t.getEndProps(),s,!1),this._appendCustomAnimate(t,s),this}to(t,e,i,n){(null==e||e<0)&&(e=0);const s="string"==typeof i?jC[i]:i,r=this._addStep(e,null,s);return r.type=ZA.to,this._appendProps(t,r,!!n&&n.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),n&&n.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,n){this.to(t,0,i,n);const s={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{s[t]=this.getLastPropByName(t,this.stepTail)})),this.to(s,e,i,n),this.stepTail.type=ZA.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ZA.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const n=new GC(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(n),this.stepTail=n,n}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let n=e.prev;const s=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));n.prev;)n.props&&(n.propKeys||(n.propKeys=Object.keys(n.props)),n.propKeys.forEach((t=>{void 0===s[t]&&(s[t]=n.props[t])}))),n=n.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(s)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,n=this.loop,s=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=n*i+i,o&&(a=i,r=n,t=a*r+i),t===s)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const n=this.position,s=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=n;)i=r,r=i.next;let a=t?0===s?1:n/s:(n-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return console.warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class GC{constructor(t,e,i,n){this.duration=e,this.position=t,this.props=i,this.easing=n}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const UC=200,YC="cubicOut",XC=1e3,$C="quadInOut";var KC;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(KC||(KC={}));const qC=[!1,!1,!1,!1],ZC=[0,0,0,0],JC=t=>t?f(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(ZC[0]=t[0],ZC[2]=t[0],ZC[1]=t[1],ZC[3]=t[1],ZC):t:t:0,QC=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],tT=[1,2,3,0,1,2,3,0];function eT(t,e,i,n){for(;t>=Tt;)t-=Tt;for(;t<0;)t+=Tt;for(;t>e;)e+=Tt;QC[0].x=i,QC[1].y=i,QC[2].x=-i,QC[3].y=-i;const s=Math.ceil(t/Mt)%4,r=Math.ceil(e/Mt)%4;if(n.add(Rt(t)*i,It(t)*i),n.add(Rt(e)*i,It(e)*i),s!==r||e-t>kt){let t=!1;for(let e=0;ee.length){n=e.map((t=>{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{const e=new Gt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let s=0;s{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)}}aT.TimeOut=1e3/60;const oT=new aT;class lT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,n,s,r;this.fromNumber=y(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=y(null===(n=this.to)||void 0===n?void 0:n.text)?null===(s=this.to)||void 0===s?void 0:s.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1)}onEnd(){}onUpdate(t,e,i){var n,s;!1!==this.valid&&(i.text=t?this.toNumber.toFixed():(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(null!==(s=null===(n=this.params)||void 0===n?void 0:n.fixed)&&void 0!==s?s:0))}}var hT;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(hT||(hT={}));class cT extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this.newPointAnimateType="appear"===(null==s?void 0:s.newPointAnimateType)?"appear":"grow"}onBind(){var t,e;const i=null===(t=this.from)||void 0===t?void 0:t.points,n=null===(e=this.to)||void 0===e?void 0:e.points;this.fromPoints=i?Array.isArray(i)?i:[i]:[],this.toPoints=n?Array.isArray(n)?n:[n]:[];const s=new Map;this.fromPoints.forEach((t=>{t.context&&s.set(t.context,t)}));let r,a,o=1/0,l=-1/0;for(let t=0;t=0;t-=1)if(s.has(this.toPoints[t].context)){l=t,a=s.get(this.toPoints[t].context);break}let h=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=s.get(t.context);return i?(h=i,[i,t]):"appear"===this.newPointAnimateType?[t,t]:el&&a?[a,t]:[h,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],n=new Gt(e.x,e.y,e.x1,e.y1);return n.defined=i.defined,n.context=i.context,n}))}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=iT(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}}class dT extends HC{constructor(t,e,i,n,s){super(null,null,i,n,s),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==s?void 0:s.group,this._clipGraphic=null==s?void 0:s.clipGraphic}onBind(){this._group&&this._clipGraphic&&(this._lastClip=this._group.attribute.clip,this._lastPath=this._group.attribute.path,this._group.setAttributes({clip:!0,path:[this._clipGraphic]},!1,{type:$A.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const n={};Object.keys(this.clipFromAttribute).forEach((t=>{n[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(n,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class uT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p,g,f,v;const m=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},y=null!==(o=m.width)&&void 0!==o?o:0,_=null!==(l=m.height)&&void 0!==l?l:0,b=null!==(h=null==s?void 0:s.animationType)&&void 0!==h?h:"in",x=null!==(c=null==s?void 0:s.startAngle)&&void 0!==c?c:0,S=null!==(d=null==s?void 0:s.orient)&&void 0!==d?d:"clockwise";let w=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(w=x,A="out"===b?x+2*Math.PI:x);const k=oM.graphicService.creator.arc({x:null!==(p=null===(u=null==s?void 0:s.center)||void 0===u?void 0:u.x)&&void 0!==p?p:y/2,y:null!==(f=null===(g=null==s?void 0:s.center)||void 0===g?void 0:g.y)&&void 0!==f?f:_/2,outerRadius:null!==(v=null==s?void 0:s.radius)&&void 0!==v?v:(y+_)/2,innerRadius:0,startAngle:w,endAngle:A,fill:!0});let M,C;"anticlockwise"===S?(M={startAngle:x+2*Math.PI},C={startAngle:x}):(M={endAngle:x},C={endAngle:x+2*Math.PI}),super("in"===b?M:C,"in"===b?C:M,i,n,{group:null==s?void 0:s.group,clipGraphic:k})}}class pT extends dT{constructor(t,e,i,n,s){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==s?void 0:s.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},f=null!==(l=null!==(o=null==s?void 0:s.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,v=null!==(c=null!==(h=null==s?void 0:s.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,m=null!==(d=null==s?void 0:s.animationType)&&void 0!==d?d:"in",y=null!==(u=null==s?void 0:s.direction)&&void 0!==u?u:"x",_=null!==(p=null==s?void 0:s.orient)&&void 0!==p?p:"positive",b=oM.graphicService.creator.rect({x:0,y:0,width:"in"===m&&"x"===y?0:f,height:"in"===m&&"y"===y?0:v,fill:!0});let x={},S={};"y"===y?"negative"===_?(x={y:v,height:0},S={y:0,height:v}):(x={height:0},S={height:v}):"negative"===_?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===m?x:S,"in"===m?S:x,i,n,{group:null==s?void 0:s.group,clipGraphic:b})}}class gT extends HC{onStart(){const{center:t,r:e}="function"==typeof this.params?this.params():this.params,i=this.target.getComputedAttribute("x"),n=this.target.getComputedAttribute("y"),s=this.target.getComputedAttribute("z"),r=Math.acos((n-t.y)/e);let a=Math.acos((i-t.x)/e/Math.sin(r));s-t.z<0&&(a=Tt-a),this.theta=a,this.phi=r}onBind(){}onEnd(){}onUpdate(t,e,i){if(null==this.phi||null==this.theta)return;const{center:n,r:s}="function"==typeof this.params?this.params():this.params,r=2*Math.PI*e,a=this.theta+r,o=this.phi,l=s*Math.sin(o)*Math.cos(a)+n.x,h=s*Math.cos(o)+n.y,c=s*Math.sin(o)*Math.sin(a)+n.z;for(i.x=l,i.y=h,i.z=c,i.alpha=a+kt/2;i.alpha>Tt;)i.alpha-=Tt;i.alpha=Tt-i.alpha,i.zIndex=-1e4*i.z}}class fT extends HC{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class vT extends HC{constructor(t,e){super(null,null,t,"linear"),this.customAnimates=e}initAnimates(){this.customAnimates.forEach((t=>{t.step=this.step,t.subAnimate=this.subAnimate,t.target=this.target}))}getEndProps(){const t={};return this.customAnimates.forEach((e=>{Object.assign(t,e.getEndProps())})),t}onBind(){this.initAnimates(),this.customAnimates.forEach((t=>{t.onBind()}))}onEnd(){this.customAnimates.forEach((t=>{t.onEnd()}))}onUpdate(t,e,i){this.updating||(this.updating=!0,this.customAnimates.forEach((n=>{const s=n.easing,r="string"==typeof s?jC[s]:s;e=r(e),n.onUpdate(t,e,i)})),this.updating=!1)}}function mT(t,e,i,n,s,r){const a=(e-t)*s+t,o=(i-e)*s+e,l=(n-i)*s+i,h=(o-a)*s+a,c=(l-o)*s+o,d=(c-h)*s+h;r[0]=t,r[1]=a,r[2]=h,r[3]=d,r[4]=d,r[5]=c,r[6]=l,r[7]=n}function yT(t,e){const i=t.length,n=e.length;if(i===n)return[t,e];const s=[],r=[],a=i{at(e,n)&&at(i,s)||t.push(e,i,n,s,n,s)};function AT(t){const e=t.commandList,i=[];let n,s=0,r=0,a=0,o=0;const l=(t,e)=>{n&&n.length>2&&i.push(n),n=[t,e]};let h,c,d,u;for(let t=0,i=e.length;tf:iv:i2&&i.push(n),i}function kT(t,e){for(let i=0;i2){e.moveTo(n[0],n[1]);for(let t=2;t=e?(r=Math.ceil(Math.sqrt(i*n)),s=Math.floor(i/r),0===s&&(s=1,r=i)):(s=Math.ceil(Math.sqrt(i/n)),r=Math.floor(i/s),0===r&&(r=1,s=i));const a=[];for(let t=0;t0)for(let t=0;t{const i=t.filter((t=>!1!==t.defined&&y(t.x)&&y(t.y)));if(0===i.length)return[];if(1===i.length)return new Array(e).fill(0).map((t=>i[0]));const n=[];if(e<=i.length){const t=i.length/e;let s=0,r=0;for(;st.map((t=>({x:t.x,y:t.y}))),PT=(t,e,i)=>{const n=t.length,s=[];for(let o=0;ot.dot-e.dot));let o=s[0],l=s[s.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+n;e<=i;e++){const i=t[e%n];u.push({x:i.x,y:i.y})}return u.push({x:h.x,y:h.y}),[d,u]},RT=(t,e,i)=>{if(1===e)i.push({points:t});else{const n=Math.floor(e/2),s=(t=>{const e=new Xt;t.forEach((t=>{e.add(t.x,t.y)}));const i=e.width(),n=e.height();if(i>=n){const n=e.x1+i/2;return PT(t,{x:n,y:e.y1},{x:n,y:e.y2})}const s=e.y1+n/2;return PT(t,{x:e.x1,y:s},{x:e.x2,y:s})})(t);RT(s[0],n,i),RT(s[1],e-n,i)}};var OT={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const BT={};for(const t in OT)P(OT,t)&&(BT[OT[t]]=t);const IT={to:{},get:{}};function DT(t,e,i){return Math.min(Math.max(e,t),i)}function LT(t){const e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}IT.get=function(t){let e,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];switch(t.substring(0,3).toLowerCase()){case"hsl":e=IT.get.hsl(t,n),i="hsl";break;case"hwb":e=IT.get.hwb(t,n),i="hwb";break;default:e=IT.get.rgb(t,n),i="rgb"}return e?{model:i,value:e}:null},IT.get.rgb=function(t){if(!t)return null;const e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];let i,n,s;if(i=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(s=i[2],i=i[1],n=0;n<3;n++){const t=2*n;e[n]=parseInt(i.slice(t,t+2),16)}s&&(e[3]=Math.round(parseInt(s,16)/255*100)/100)}else if(i=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=i[1],s=i[3],n=0;n<3;n++)e[n]=parseInt(i[n]+i[n],16);s&&(e[3]=Math.round(parseInt(s+s,16)/255*100)/100)}else if(i=t.match(/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/)){for(n=0;n<3;n++)e[n]=parseInt(i[n+1],10);i[4]&&(e[3]=parseFloat(i[4]))}else{if(!(i=t.match(/^rgba?\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/))){if(i=t.match(/(\D+)/)){if("transparent"===i[1])return[0,0,0,0];const t=OT[i[1]];return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e?(e[3]=1,e):null}return null}for(n=0;n<3;n++)e[n]=Math.round(2.55*parseFloat(i[n+1]));i[4]&&(e[3]=parseFloat(i[4]))}for(n=0;n<3;n++)e[n]=DT(e[n],0,255);return e[3]=DT(e[3],0,1),e},IT.get.hsl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.get.hwb=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,1];if(!t)return null;const i=t.match(/^hwb\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/);if(i){const t=parseFloat(i[4]);return e[0]=(parseFloat(i[1])%360+360)%360,e[1]=DT(parseFloat(i[2]),0,100),e[2]=DT(parseFloat(i[3]),0,100),e[3]=DT(isNaN(t)?1:t,0,1),e}return null},IT.to.hex=function(){for(var t=arguments.length,e=new Array(t),i=0;i=4&&1!==n[3]&&(s=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+s+")"},IT.to.keyword=function(t){return BT[t.slice(0,3)]};const FT=IT;var jT;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(jT||(jT={}));class zT{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jT.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===jT.Color1){let e=zT.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;if(e=IT.get(t),e&&e.value){const n=e.value,s=[n[0]/255,n[1]/255,n[2]/255,n[3]];zT.store1[t]=s,zT.store255[t]=n,i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3]}return i}let n=zT.store255[t];if(n)return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=n[3],i;if(n=IT.get(t),n&&n.value){const e=n.value;zT.store1[t]=[e[0]/255,e[1]/255,e[2]/255,e[3]],zT.store255[t]=e,i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}static Set(t,e,i){if(e===jT.Color1){if(zT.store1[t])return;zT.store1[t]=i,zT.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(zT.store255[t])return;zT.store255[t]=i,zT.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function HT(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)?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 NT(t,e,i,n,s){if(!t||!e)return t&&HT(t)||e&&HT(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=zT.Get(t,jT.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=zT.Get(e,jT.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:HT(a)})))});return o?NT(r,l,i,n,s):NT(l,r,i,n,s)}if(o){if(t.gradient===e.gradient){const n=t,s=e,r=n.stops,a=s.stops;if(r.length!==a.length)return!1;if("linear"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("radial"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i);if("conical"===n.gradient)return function(t,e,i){const n=t.stops,s=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(n.length).fill(0).map(((t,e)=>({color:GT(n[e].color,s[e].color,i),offset:n[e].offset+(s[e].offset-n[e].offset)*i})))}}(n,s,i)}return!1}return s&&s(r,a),HT(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),n)}zT.store255={},zT.store1={};const VT=[0,0,0,0],WT=[0,0,0,0];function GT(t,e,i){return zT.Get(t,jT.Color255,VT),zT.Get(e,jT.Color255,WT),`rgba(${Math.round(VT[0]+(WT[0]-VT[0])*i)},${Math.round(VT[1]+(WT[1]-VT[1])*i)},${Math.round(VT[2]+(WT[2]-VT[2])*i)},${VT[3]+(WT[3]-VT[3])*i})`}const UT=(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 n=NT(t.from,t.to,i,!1);n&&(e[t.key]=n)}}))},YT=(t,e,i)=>{const n=[],s=[];e.clear();for(let r=0;r{const n=t?AT(t):[],s=AT(e);i&&n&&(i.fromTransform&&kT(n,i.fromTransform.clone().getInverse()),kT(n,i.toTransfrom));const[r,a]=function(t,e){let i,n;const s=[],r=[];for(let a=0;a0){const t=n/i;for(let e=-n/2;e<=n/2;e+=t){const t=Math.sin(e),i=Math.cos(e);let n=0;for(let e=0;e({from:r[e],to:t,fromCp:[0,0],toCp:[0,0],rotation:0})))},$T=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],KT=(t,e)=>{if(!t||!e)return null;const i=[];let n=!1;return Object.keys(t).forEach((s=>{if(!$T.includes(s))return;const r=e[s];l(r)||l(t[s])||r===t[s]||("fill"===s||"stroke"===s?i.push({from:"string"==typeof t[s]?zT.Get(t[s],jT.Color255):t[s],to:"string"==typeof r?zT.Get(r,jT.Color255):r,key:s}):i.push({from:t[s],to:r,key:s}),n=!0)})),n?i:null};class qT extends HC{constructor(t,e,i){super(0,1,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 n=this.target,s="function"==typeof n.pathProxy?n.pathProxy(n.attribute):n.pathProxy;YT(this.morphingData,s,e),this.otherAttrs&&this.otherAttrs.length&&UT(this.otherAttrs,i,e),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ZT=(t,e,i,n)=>{var s,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;n&&o&&(o=n.clone().multiply(o.a,o.b,o.c,o.d,o.e,o.f));const l=XT(null===(s=null==t?void 0:t.toCustomPath)||void 0===s?void 0:s.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=KT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);return(null==i?void 0:i.delay)&&c.wait(i.delay),c.play(new qT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:XC,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$C)),c};class JT extends HC{constructor(t,e,i){super(0,1,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 n;YT(this.morphingData[i],"function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy,e),(null===(n=this.otherAttrs)||void 0===n?void 0:n[i])&&this.otherAttrs[i].length&&UT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const QT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>sT.includes(t))(i)||(e[i]=t[i])})),e},tE=(t,e,i)=>{const n=QT(t.attribute),s=t.attachShadow();if(e.length)s.setTheme({[e[0].type]:n}),e.forEach((t=>{s.appendChild(t)}));else{const r=t.AABBBounds,a=r.width(),o=r.height();s.setTheme({rect:n}),new Array(i).fill(0).forEach((t=>{const i=oM.graphicService.creator.rect({x:0,y:0,width:a,height:o});s.appendChild(i),e.push(i)}))}},eE=(t,e,i)=>{const n=[],s=i?null:QT(t.attribute),r=t.toCustomPath();for(let t=0;t{const n=[],s=i?null:QT(t.attribute);if("rect"===t.type)((t,e)=>{const i=t.getComputedAttribute("width"),n=t.getComputedAttribute("height"),s=CT(i,n,e),r=[],a=n/s.length;for(let t=0,e=s.length;t{n.push(oM.graphicService.creator.rect(i?t:Object.assign({},s,t)))}));else if("arc"===t.type)((t,e)=>{const i=t.getParsedAngle(),n=i.startAngle,s=i.endAngle,r=t.getComputedAttribute("innerRadius"),a=t.getComputedAttribute("outerRadius"),o=Math.abs(n-s),l=Math.abs(a-r),h=CT(o*(r+a)/2,l,e),c=[],d=l/h.length,u=a>=r?1:-1,p=s>=n?1:-1;for(let t=0,e=h.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("circle"===t.type)((t,e)=>{const i=t.getComputedAttribute("startAngle"),n=t.getComputedAttribute("endAngle"),s=t.getComputedAttribute("radius"),r=Math.abs(i-n),a=CT(r*s,s,e),o=[],l=r/a[0],h=s/a.length,c=n>=i?1:-1;for(let t=0,e=a.length;t{n.push(oM.graphicService.creator.arc(i?t:Object.assign({},s,t)))}));else if("line"===t.type){const r=((t,e)=>{const i=t.attribute,n=i.points;if(n)return TT(n,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 TT(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{n.push(oM.graphicService.creator.symbol(i?Object.assign({},t,a):Object.assign({},s,t,a)))}))}else"polygon"===t.type?((t,e)=>{const i=t.attribute.points;if(!i||!i.length)return[];if(1===e)return[{points:ET(i)}];const n=[];return RT(i,e,n),n})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"area"===t.type?((t,e)=>{var i,n;const s=t.attribute;let r=s.points;const a=s.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&&y(t.x)&&y(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!==(n=e.y1)&&void 0!==n?n:e.y})}const h=[];return RT(r,e,h),h})(t,e).forEach((t=>{n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))})):"path"===t.type&&((t,e)=>{const i=AT(t.getParsedPathShape());if(!i.length||e<0)return[];const n=i.length;if(i.length>=e){const t=[],s=Math.floor(i.length/e);for(let r=0;r{"path"in t?n.push(oM.graphicService.creator.path(i?t:Object.assign({},s,t))):n.push(oM.graphicService.creator.polygon(i?t:Object.assign({},s,t)))}));return i&&tE(t,n,e),n};class nE{static GetImage(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadImage(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetSvg(t,e){var i;let n=nE.cache.get(t);n?"fail"===n.loadState?oM.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===n.loadState||"loading"===n.loadState?null===(i=n.waitingMark)||void 0===i||i.push(e):e&&oM.global.getRequestAnimationFrame()((()=>{e.imageLoadSuccess(t,n.data)})):(n={type:"image",loadState:"init"},nE.cache.set(t,n),n.dataPromise=oM.global.loadSvg(t),n.dataPromise?(n.waitingMark=[e],n.dataPromise.then((e=>{var i;n.loadState=(null==e?void 0:e.data)?"success":"fail",n.data=null==e?void 0:e.data,null===(i=n.waitingMark)||void 0===i||i.map(((i,s)=>{(null==e?void 0:e.data)?(n.loadState="success",n.data=e.data,i.imageLoadSuccess(t,e.data)):(n.loadState="fail",i.imageLoadFail(t))}))}))):(n.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=nE.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},nE.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=oM.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=oM.global.loadBlob(t):"json"===e&&(i.dataPromise=oM.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}}nE.cache=new Map;const sE=new ee,rE=["lineWidth","lineCap","lineJoin","miterLimit","scaleX","scaleY","angle","anchor"],aE=["x","y"],oE=["scaleX","scaleY"],lE=["angle"],hE=new Gt;class cE extends yC{static mixin(t){const e=Object.keys(t);for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};super(),this._AABBBounds=new $t,this._updateTag=YA.INIT,this.attribute=t,this.valid=this.isValid(),t.background&&this.loadImage(t.background,!0)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{dx:i=t.dx,dy:n=t.dy}=this.attribute;if(e&&this.parent){const t=fC(this.parent).group,{scrollX:e=t.scrollX,scrollY:s=t.scrollY}=this.parent.attribute;hE.x=i+e,hE.y=n+s}else hE.x=i,hE.y=n;return hE}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this.AABBBounds.clone(),this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();return this.shouldUpdateGlobalMatrix()&&this.doUpdateGlobalMatrix(),this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!0}tryUpdateLocalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ee),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&YA.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&YA.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&YA.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&YA.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=YA.CLEAR_SHAPE}containsPoint(t,e,i,n){if(!n)return!1;if(i===XA.GLOBAL){const i=new Gt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return n.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background&&this.loadImage(t.background,!0),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const n=Object.keys(t);for(let e=0;e{this.animates.delete(e.id)})),e}onAttributeUpdate(t){oM.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t)}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!l(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,n){var s,r,a,o;if(i){const i=Object.keys(t),l=n?i.reduce(((e,i)=>(e[i]=void 0===t[i]?this.getDefaultAttribute(i):t[i],e)),{}):t,h=this.animate();h.stateNames=e,h.to(l,null!==(r=null===(s=this.stateAnimateConfig)||void 0===s?void 0:s.duration)&&void 0!==r?r:UC,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:YC)}else this.setAttributes(t,!1,{type:$A.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}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const n=i.getEndProps();P(n,t)&&(e=n[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs&&this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[]}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var n;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const s=e&&(null===(n=this.currentStates)||void 0===n?void 0:n.length)?this.currentStates.concat([t]):[t];this.useStates(s,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 n={};t.forEach((e=>{var i;const s=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];s&&Object.assign(n,s)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=YA.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=YA.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&YA.UPDATE_SHAPE_AND_BOUNDS)===YA.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=YA.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=YA.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=YA.CLEAR_GLOBAL_MATRIX}doUpdateLocalMatrix(){const{x:t=jk.x,y:e=jk.y,scaleX:i=jk.scaleX,scaleY:n=jk.scaleY,angle:s=jk.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute,l=[0,0];if(a){if("string"==typeof a[0]){const t=parseFloat(a[0])/100,e=this.AABBBounds;l[0]=e.x1+(e.x2-e.x1)*t}else l[0]=a[0];if("string"==typeof a[1]){const t=parseFloat(a[1])/100,e=this.AABBBounds;l[1]=e.x1+(e.x2-e.x1)*t}else l[1]=a[1]}if(!r||1===i&&1===n)!function(t,e,i,n,s,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Rt(a),f=It(a);let v,m;o?(v=o[0],m=o[1]):(v=i,m=n);const y=v-i,_=m-n,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,w=d*g-h*f;t.a=s*b,t.b=s*x,t.c=r*S,t.d=r*w,t.e=u+l*v+c*m-b*y-S*_,t.f=p+h*v+d*m-x*y-w*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,n,s,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(s),a.translate(-l[0],-l[1]),a.translate(t,e),oM.transformUtil.fromMatrix(a,a).scale(i,n,{x:r[0],y:r[1]})}const h=this.getOffsetXY(jk);if(this._transMatrix.e+=h.x,this._transMatrix.f+=h.y,o){const t=sE.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){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),oM.graphicService.onSetStage(this,t))}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$A.ANIMATE_END})}onStep(t,e,i,n,s){const r={};if(i.customAnimate)i.customAnimate.update(s,n,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,n,s,a,void 0,o,l)}this.setAttributes(r,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:n,end:s,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,n,s,r,a,o,l,h){h||(h=Object.keys(a),n.propKeys=h),r?n.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,n);let u;u=e.interpolateFunc&&e.interpolateFunc(r,s,d,c,i),u||(u=e.customInterpolate(r,s,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,s)||this._interpolate(r,s,d,c,i))})),n.parsedProps=l}defaultInterpolate(t,e,i,n,s,r){if(Number.isFinite(t))return n[i]=e+(t-e)*r,!0;if("fill"===i){s||(s={});const a=s.fillColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.fillColorArray=e}));return o&&(n[i]=o),!0}if("stroke"===i){s||(s={});const a=s.strokeColorArray,o=NT(e,null!=a?a:t,r,!1,((t,e)=>{s.strokeColorArray=e}));return o&&(n[i]=o),!0}if("shadowColor"===i){s||(s={});const a=s.shadowColorArray,o=NT(e,null!=a?a:t,r,!0,((t,e)=>{s.shadowColorArray=e}));return o&&(n[i]=o),!0}return!1}_interpolate(t,e,i,n,s){}getDefaultAttribute(t){return fC(this)[this.type][t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:oM.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot=null)}toJson(){return{attribute:this.attribute,_uid:this._uid,type:this.type,name:this.name,children:this.children.map((t=>t.toJson()))}}createPathProxy(t){return g(t,!0)?this.pathProxy=(new Dk).fromString(t):this.pathProxy=new Dk,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return;const i=t;this.resources||(this.resources=new Map);const n={data:"init",state:null};this.resources.set(i,n),"string"==typeof t?(n.state="loading",b(t)||S(t)?(nE.GetImage(t,this),this.backgroundImg=this.backgroundImg||e):t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released"}_emitCustomEvent(t,e){var i,n;if(this._events&&t in this._events){const s=new wC(t,e);s.bubbles=!1,s.manager=null===(n=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===n?void 0:n.manager,this.dispatchEvent(s)}}}cE.mixin(CC);var dE=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function uE(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(n/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let pE=0;function gE(){return pE++}var fE;function vE(t){const e=[];let i=0,n="";for(let s=0;smE.set(t,!0)));const yE=new Map;function _E(t){if(mE.has(t))return!0;if(yE.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>yE.set(t,!0)));const bE=gE(),xE=gE(),SE=gE(),wE=gE(),AE=gE(),kE=gE(),ME=gE(),CE=gE(),TE=gE(),EE=gE(),PE=gE(),RE=gE(),OE=gE(),BE=gE(),IE=gE(),DE=gE(),LE=Symbol.for("GraphicService"),FE=Symbol.for("GraphicCreator");var jE;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(jE||(jE={}));let zE=class t extends cE{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=kE,this._childUpdateTag=YA.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 pC),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new pC)}hideAll(){this.setAttribute("visible",!1),this.forEachChildren((t=>{t.isContainer&&t.hideAll?t.hideAll():t.setAttribute("visible",!1)}))}showAll(){this.setAttribute("visible",!0),this.forEachChildren((t=>{t.isContainer&&t.showAll?t.showAll():t.setAttribute("visible",!0)}))}containsPoint(t,e,i){if(i===XA.GLOBAL){const i=new Gt(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&YA.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;oM.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return oM.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateAABBBounds(){const t=this.attribute,e=fC(this).group;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=oM.graphicService.updateGroupAABBBounds(t,fC(this).group,this._AABBBounds,this),{boundsPadding:n=e.boundsPadding}=t,s=JC(n);return s&&i.expand(s),this.parent&&this.parent.addChildUpdateBoundTag(),this.clearUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),i}clearUpdateBoundTag(){this._updateTag&=YA.CLEAR_BOUNDS,this._childUpdateTag&=YA.CLEAR_BOUNDS}tryUpdateOBBBounds(){throw new Error("暂不支持")}addUpdateBoundTag(){this._updateTag|=YA.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&YA.UPDATE_BOUNDS||(this._childUpdateTag|=YA.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(),oM.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),oM.graphicService.onClearIncremental(this,this.stage)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){const i=super.insertBefore(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertAfter(t,e){const i=super.insertAfter(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertInto(t,e){const i=super.insertInto(t,e);return this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}removeChild(t){const e=super.removeChild(t);return t.stage=null,oM.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){this.forEachChildren((t=>{oM.graphicService.onRemove(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),oM.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&YA.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let n=this._getChildByName(t);return n?n.setAttributes(e):(n=oM.graphicService.creator[i](e),n.name=t,this.add(n)),n}clone(){return new t(Object.assign({},this.attribute))}};const HE=Symbol.for("LayerHandlerContribution");class NE extends zE{get offscreen(){return this.layerHandler.offscreen}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,n){var s;super({}),this.stage=t,this.global=e,this.window=i,this.main=n.main,this.layerHandler=SM.get(HE),this.layerHandler.init(this,i,{main:n.main,canvasId:n.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(s=n.zIndex)&&void 0!==s?s:0}),this.layer=this,this.subLayers=new Map,this.theme=new pC,this.background="rgba(0, 0, 0, 0)",this.virtual=!!n.virtual,this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{oM.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("暂不支持")}render(t,e){var i;const n=this.stage;this.layerHandler.render([this],{renderService:t.renderService,x:n.x,y:n.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this)))}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){}combineTo(t,e){var i;this.offscreen&&(this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this))))}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{oM.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,x:this.stage.x,y:this.stage.y,width:this.viewWidth,height:this.viewHeight,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}var VE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},WE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GE=function(t,e){return function(i,n){e(i,n,t)}};let UE=class{constructor(t){this.global=t,this.layerMap=new Map}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};this.tryInit();const i=new NE(t,this.global,t.window,Object.assign(Object.assign({},e),{virtual:0===this.staticLayerCountInEnv})),n=this.layerMap.get(t)||[];return n.push(i),this.layerMap.set(t,n),this.staticLayerCountInEnv--,i}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}};UE=VE([fA(),GE(0,yA(EA)),WE("design:paramtypes",[Object])],UE);var YE=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XE=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$E=function(t,e){return function(i,n){e(i,n,t)}};const KE=Symbol.for("VWindow"),qE=Symbol.for("WindowHandlerContribution");let ZE=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(t){this.global=t,this.hooks={onChange:new CA(["x","y","width","height"])},this._uid=vC.GenAutoIncrementId()}postInit(){this.global.hooks.onSetEnv.tap("window",(()=>{this.active()})),this.active()}active(){const t=this.global;t.env&&!this.actived&&(SM.getNamed(qE,t.env).configure(this,t),this.actived=!0)}get style(){return this._handler.getStyle()}set style(t){this._handler.setStyle(t)}create(t){this._handler.createWindow(t);const e=this._handler.getWH();this._width=e.width,this._height=e.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._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t,e){this._handler.clearViewBox(t,e)}};YE([SA(),XE("design:type",Function),XE("design:paramtypes",[]),XE("design:returntype",void 0)],ZE.prototype,"postInit",null),ZE=YE([fA(),$E(0,yA(EA)),XE("design:paramtypes",[Object])],ZE);const JE=Symbol.for("TransformUtil"),QE=Symbol.for("GraphicUtil"),tP=Symbol.for("LayerService");var eP=new cA((t=>{t(BA).toSelf().inSingletonScope(),t(EA).toService(BA),t(ZE).to(ZE),t(KE).toService(ZE),t(sC).toSelf().inSingletonScope(),t(QE).toService(sC),t(oC).toSelf().inSingletonScope(),t(JE).toService(oC),t(UE).toSelf().inSingletonScope(),t(tP).toService(UE)}));function iP(t,e){return!(!t&&!e)}function nP(t,e){let i;return i=f(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function sP(t,e,i){return i&&t*e>0}function rP(t,e,i,n,s){return s&&t*e>0&&i>0&&n>0}function aP(t,e){return t*e>0}function oP(t,e,i,n){return t*e>0&&i>0&&n>0}function lP(t,e,i,n,s,r,a,o){if(!t.pathProxy)return!1;const l=fC(t,null==r?void 0:r.theme)[t.type],{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}=t.attribute,v=sP(d,u,h),m=aP(d,g),y=iP(h),_=nP(c,p);if(!f)return!0;if(!y&&!_)return!0;if(!(v||m||a||o))return!0;e.beginPath();return rk(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,n),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),_&&(o?o(e,t.attribute,l):m&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),y&&(a?a(e,t.attribute,l):v&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),!0}function hP(t,e,i,n,s,r,a,o){const l=i-t,h=n-e,c=a-s,d=o-r;let u=d*l-c*h;return u*uP*P+R*R&&(A=M,k=C),{cx:A,cy:k,x01:-c,y01:-d,x11:A*(s/x-1),y11:k*(s/x-1)}}function dP(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(s=Tt-At)e.moveTo(i+s*Rt(o),n+s*It(o)),e.arc(i,n,s,o,l,!c),r>At&&(e.moveTo(i+r*Rt(l),n+r*It(l)),e.arc(i,n,r,l,o,c));else{const u=t.getParsedCornerRadius(),{outerDeltaAngle:p,innerDeltaAngle:g,outerStartAngle:f,outerEndAngle:v,innerEndAngle:m,innerStartAngle:y}=t.getParsePadAngle(o,l),_=u,b=u,x=u,S=u,w=Math.max(b,_),A=Math.max(x,S);let k=w,M=A;const C=s*Rt(f),T=s*It(f),E=r*Rt(m),P=r*It(m);let R,O,B,I;if((A>At||w>At)&&(R=s*Rt(v),O=s*It(v),B=r*Rt(y),I=r*It(y),hAt){const t=Bt(_,k),r=Bt(b,k),o=cP(B,I,C,T,s,t,Number(c)),l=cP(R,O,E,P,s,r,Number(c));k0&&e.arc(i+o.cx,n+o.cy,t,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,s,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,n+l.cy,r,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Rt(Pt(l.y01,l.x01)),n+l.cy+r*It(Pt(l.y01,l.x01))):e.moveTo(i+R,n+s*It(v))}else a&&!a[0]||(e.moveTo(i+C,n+T),e.arc(i,n,s,f,v,!c));if(!(r>At)||g<.001)!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),d=!0;else if(M>At){const t=Bt(S,M),s=Bt(x,M),o=cP(E,P,R,O,r,-s,Number(c)),l=cP(C,T,B,I,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,n+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,n+o.cy+o.y01),M0&&e.arc(i+o.cx,n+o.cy,s,Pt(o.y01,o.x01),Pt(o.y11,o.x11),!c),e.arc(i,n,r,Pt(o.cy+o.y11,o.cx+o.x11),Pt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,n+l.cy,t,Pt(l.y11,l.x11),Pt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Rt(Pt(l.y01,l.x01)),n+l.cy+t*It(Pt(l.y01,l.x01))):e.moveTo(i+B,n+I)}else!a||a[1]?e.lineTo(i+E,n+P):e.moveTo(i+E,n+P),!a||a[2]?e.arc(i,n,r,m,y,c):e.moveTo(i+r*Rt(y),n+r*It(y))}return a?a[3]&&e.lineTo(i+s*Rt(l),n+s*Rt(l)):e.closePath(),d}class uP{static GetCanvas(){try{return uP.canvas||(uP.canvas=oM.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{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;const i=uP.GetCanvas(),n=uP.GetCtx();if(i.width=e,i.height=1,!n)return;if(n.translate(0,0),!n)throw new Error("获取ctx发生错误");const s=n.createLinearGradient(0,0,e,0);t.forEach((t=>{s.addColorStop(t[0],t[1])})),n.fillStyle=s,n.fillRect(0,0,e,1),this.rgbaSet=n.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})`}static GetOrCreate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i="";t.forEach((t=>i+=t.join())),i+=e;let n=pP.dataMap.get(i);return n||(n=new pP(t,e),pP.dataMap.set(i,n)),n}static SetColorInterpolateInstance(t,e){pP.dataMap.set(t,e)}static GetColorInterpolateInstance(t){return pP.dataMap.get(t)}}pP.dataMap=new Map;class gP{static GetSize(t){for(let e=0;e=t)return gP.ImageSize[e];return t}static Get(t,e,i,n,s,r,a){const o=gP.GenKey(t,e,i,n,s),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,n,s,r,a,o){const l=gP.GenKey(t,e,i,n,s);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,n,s){return`${e},${i},${n},${s},${t.join()}`}}gP.cache={},gP.ImageSize=[20,40,80,160,320,640,1280,2560];const fP=Symbol.for("ArcRenderContribution"),vP=Symbol.for("AreaRenderContribution"),mP=Symbol.for("CircleRenderContribution"),yP=Symbol.for("GroupRenderContribution"),_P=Symbol.for("ImageRenderContribution"),bP=Symbol.for("PathRenderContribution"),xP=Symbol.for("PolygonRenderContribution"),SP=Symbol.for("RectRenderContribution"),wP=Symbol.for("SymbolRenderContribution"),AP=Symbol.for("TextRenderContribution"),kP=Symbol.for("InteractiveSubRenderContribution");var MP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},TP=function(t,e){return function(i,n){e(i,n,t)}};let EP=class{constructor(t){this.arcRenderContribitions=t,this.numberType=bE}drawArcTailCapPath(t,e,i,n,s,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=Et(d-c),p=d>c;let g=!1;if(sAt||M>At)&&(I=s*Rt(_),D=s*It(_),L=r*Rt(x),F=r*It(x),uAt){const t=Bt(S,T),r=Bt(w,T),a=cP(L,F,P,R,s,t,Number(p)),o=cP(I,D,O,B,s,r,Number(p));if(T0&&e.arc(i+o.cx,n+o.cy,r,Pt(o.y11,o.x11),Pt(o.y01,o.x01),!p)}}else e.moveTo(i+P,n+R);if(!(r>At)||m<.001)e.lineTo(i+O,n+B),g=!0;else if(E>At){const t=Bt(k,E),s=Bt(A,E),a=cP(O,B,I,D,r,-s,Number(p)),o=cP(P,R,L,F,r,-t,Number(p));if(e.lineTo(i+a.cx+a.x01,n+a.cy+a.y01),E0&&e.arc(i+a.cx,n+a.cy,s,Pt(a.y01,a.x01),Pt(a.y11,a.x11),!p);const t=Pt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,n,r,t,o,p)}}else e.lineTo(i+r*Rt(x),n+r*It(x));return g}drawShape(t,e,i,n,s,r,o,l){const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible,x:y=h.x,y:_=h.y}=t.attribute,b=sP(p,g,c),x=aP(p,v),S=iP(c,d),w=nP(u,f);if(!t.valid||!m)return;if(!S&&!w)return;if(!(b||x||o||l||d))return;const{outerRadius:A=h.outerRadius,innerRadius:k=h.innerRadius,cap:M=h.cap,forceShowCap:C=h.forceShowCap}=t.attribute;let T=0;const E=(a(M)&&M||M[0])&&"conical"===c.gradient;if(E){const{sc:e,startAngle:i,endAngle:n}=t.getParsedAngle();Et(n-i){var e;let i=!0;if(a(t,!0)){for(let n=0;n<4;n++)qC[n]=t,i&&(i=!(null!==(e=qC[n])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)qC[e]=!!t[e],i&&(i=!!qC[e]);else qC[0]=!1,qC[1]=!1,qC[2]=!1,qC[3]=!1;return{isFullStroke:i,stroke:qC}})(u);if(S||R){if(e.beginPath(),dP(t,e,i,n,A,k),!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),S&&(o?o(e,t.attribute,h):b&&(e.setCommonStyle(t,t.attribute,y-i,_-n,h),e.fill())),w&&R&&(l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,y-i,_-n,h),e.stroke()))}if(!R&&w){if(e.beginPath(),dP(t,e,i,n,A,k,O),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}l?l(e,t.attribute,h):x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())}if((a(M)&&M||M[1])&&C){const{startAngle:r,endAngle:a}=t.getParsedAngle();if(Et(a-r)>=Tt-At){e.beginPath();const r=Math.abs(A-k)/2/A,{endAngle:a=h.endAngle,fill:c=h.fill}=t.attribute,d=a;if(this.drawArcTailCapPath(t,e,i,n,A,k,d,d+r),!P){if(!this._arcBeforeRenderContribitions){this._arcBeforeRenderContribitions=[],this._arcAfterRenderContribitions=[];const t=this.arcRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),t.forEach((t=>{t.time===tk.beforeFillStroke?this._arcBeforeRenderContribitions.push(t):this._arcAfterRenderContribitions.push(t)}))}P=!0,this._arcBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)}))}if(S){const s=c;if("conical"===s.gradient){const r=function(t,e,i,n){const{stops:s,startAngle:r,endAngle:a}=n;for(;i<0;)i+=Tt;for(;i>Tt;)i-=Tt;if(ia)return s[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=s[t-1],l=s[t];break}return h=(h-o.offset)/(l.offset-o.offset),NT(o.color,l.color,h,!1)}(0,0,a,s);o||sP&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=r,e.fill())}}w&&(l||x&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))}}this._arcAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,S,w,b,x,h,s,o,l)})),E&&(c.startAngle+=T,c.endAngle+=T)}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.highPerformanceSave();let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};EP=MP([fA(),TP(0,yA(wA)),TP(0,vA(fP)),CP("design:paramtypes",[Object])],EP);var PP=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RP=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OP=function(t,e){return function(i,n){e(i,n,t)}};let BP=class{constructor(t){this.circleRenderContribitions=t,this.numberType=wE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).circle,{fill:h=l.fill,background:c,stroke:d=l.stroke,radius:u=l.radius,startAngle:p=l.startAngle,endAngle:g=l.endAngle,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,opacity:m=l.opacity,lineWidth:y=l.lineWidth,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(m,f,h),w=aP(m,v),A=iP(h,c),k=nP(d,y);t.valid&&_&&(A||k)&&(S||w||a||o||c)&&(e.beginPath(),e.arc(i,n,u,p,g),e.closePath(),this._circleRenderContribitions||(this._circleRenderContribitions=this.circleRenderContribitions.getContributions()||[],this._circleRenderContribitions.sort(((t,e)=>e.order-t.order))),this._circleRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):S&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):w&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._circleRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).circle;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};BP=PP([fA(),OP(0,yA(wA)),OP(0,vA(mP)),RP("design:paramtypes",[Object])],BP);const IP=["radius","startAngle","endAngle",...rE];class DP extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=wE}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)}doUpdateAABBBounds(t){const e=fC(this).circle;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateCircleAABBBounds(i,fC(this).circle,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).circle[t]}needUpdateTags(t){for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:n=e.fontStyle,fontVariant:s=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(n?n+" ":"")+(s?s+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}function FP(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function jP(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}class zP{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,n,s,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===n||"start"===n||("center"===n?d[0]=c[0]/-2:"right"!==n&&"end"!==n||(d[0]=-c[0])),"top"===s||("middle"===s?d[1]=c[1]/-2:"bottom"===s&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,n,s,r)}GetLayoutByLines(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0;t=t.map((t=>t.toString()));const o=[],l=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,n=t.length;i0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=DE,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return null!=t&&""!==t}doUpdateAABBBounds(){const t=fC(this).text;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateTextAABBBounds(e,t,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=this.attribute,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}updateSingallineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalSinglelineAABBBounds(t):this.updateVerticalSinglelineAABBBounds(t)}updateMultilineAABBBounds(t){const e=fC(this).text,{direction:i=e.direction}=this.attribute;return"horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t)}updateHorizontalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s,r;const a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineWidth:g=i.lineWidth,wordBreak:f=i.wordBreak}=a,v=Math.max(2,.075*d),{lineHeight:m=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+v)}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,m,d);return this._AABBBounds.set(t,e,t+s,e+m),p&&this._AABBBounds.expand(g/2),this._AABBBounds}if(Number.isFinite(o)){if(l){const e=!0===l?i.ellipsis:l,a=n.clipTextWithSuffix(t.toString(),{fontSize:d,fontWeight:u},o,e,"break-word"===f);r=a.str,s=a.width}else{const e=n.clipText(t.toString(),{fontSize:d,fontWeight:u},o,"break-word"===f);r=e.str,s=e.width}this.cache.clipedText=r,this.cache.clipedWidth=s}else s=n.measureTextWidth(t.toString(),{fontSize:d,fontWeight:u}),this.cache.clipedText=t.toString(),this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s);let _=m;oM.global&&oM.global.isSafari()&&(_+=.2*d);const b=jP(c,_,d,v);return this._AABBBounds.set(y,b,y+s,b+_),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalSinglelineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(!this.shouldUpdateShape()&&this.cache){s=this.cache.clipedWidth;const t=FP(h,s),e=jP(c,g,d);return this._AABBBounds.set(e,t,e+g,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}let m=[vE(t.toString())];if(Number.isFinite(o)){if(l){const t=!0===l?i.ellipsis:l,e=n.clipTextWithSuffixVertical(m[0],{fontSize:d,fontWeight:u},o,t,"break-word"===v);m=[e.verticalList],s=e.width}else{const t=n.clipTextVertical(m[0],{fontSize:d,fontWeight:u},o,"break-word"===v);m=[t.verticalList],s=t.width}this.cache.verticalList=m,this.cache.clipedWidth=s}else s=0,m[0].forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e})),this.cache.verticalList=m,this.cache.clipedWidth=s;this.clearUpdateShapeTag();const y=FP(h,s),_=jP(c,g,d);return this._AABBBounds.set(_,y,_+g,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e;const i=fC(this).text,n=this.attribute,{fontFamily:s=i.fontFamily,textAlign:r=i.textAlign,textBaseline:a=i.textBaseline,fontSize:o=i.fontSize,fontWeight:l=i.fontWeight,lineHeight:h=n.lineHeight||n.fontSize||i.fontSize,ellipsis:c=i.ellipsis,maxLineWidth:d,stroke:u=i.stroke,lineWidth:p=i.lineWidth,wordBreak:g=i.wordBreak}=n;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 f=oM.graphicUtil.textMeasure,v=new zP(s,{fontSize:o,fontWeight:l},f).GetLayoutByLines(t,r,a,h,!0===c?i.ellipsis:c||void 0,"break-word"===g,d),{bbox:m}=v;return this.cache.layoutData=v,this.clearUpdateShapeTag(),this._AABBBounds.set(m.xOffset,m.yOffset,m.xOffset+m.width,m.yOffset+m.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}updateVerticalMultilineAABBBounds(t){var e;const i=fC(this).text,n=oM.graphicUtil.textMeasure;let s;const r=2,a=this.attribute,{maxLineWidth:o=i.maxLineWidth,ellipsis:l=i.ellipsis,textAlign:h=i.textAlign,textBaseline:c=i.textBaseline,fontSize:d=i.fontSize,fontWeight:u=i.fontWeight,stroke:p=i.stroke,lineHeight:g=(null!==(e=a.lineHeight)&&void 0!==e?e:(a.fontSize||i.fontSize)+r),lineWidth:f=i.lineWidth,wordBreak:v=i.wordBreak}=a;if(s=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const t=FP(h,s),e=this.cache.verticalList.length*g,i=jP(c,e,d);return this._AABBBounds.set(i,t,i+e,t+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}const m=t.map((t=>vE(t.toString())));m.forEach(((t,e)=>{if(Number.isFinite(o))if(l){const r=!0===l?i.ellipsis:l,a=n.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u},o,r,"break-word"===v);m[e]=a.verticalList,s=a.width}else{const i=n.clipTextVertical(t,{fontSize:d,fontWeight:u},o,"break-word"===v);m[e]=i.verticalList,s=i.width}else s=0,t.forEach((t=>{const e=t.direction===fE.HORIZONTAL?d:n.measureTextWidth(t.text,{fontSize:d,fontWeight:u});s+=e,t.width=e}))})),this.cache.verticalList=m,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);s=Ot(e,s)}));const y=FP(h,s),_=this.cache.verticalList.length*g,b=jP(c,_,d);return this._AABBBounds.set(b,y,b+_,y+s),p&&this._AABBBounds.expand(f/2),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).text[t]}needUpdateTags(t){for(let e=0;e{TR[t.type]=t}));const ER=["symbolType","size",...rE];let PR=class t extends cE{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=IE}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return f(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=fC(this).symbol,{symbolType:i=e.symbolType}=this.attribute;let n=TR[i];if(n)return this._parsedPath=n,n;if(n=t.userSymbolMap[i],n)return this._parsedPath=n,n;const s=(new Dk).fromString(i),r=s.bounds.width(),a=s.bounds.height(),o=1/Ot(r,a);return s.transform(0,0,o,o),this._parsedPath=new CR(i,s),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}doUpdateAABBBounds(t){const e=fC(this).symbol;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateSymbolAABBBounds(i,fC(this).symbol,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).symbol[t]}needUpdateTags(t){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=CE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}doUpdateAABBBounds(){const t=fC(this).line;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateLineAABBBounds(e,fC(this).line,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).line[t]}needUpdateTags(t){for(let e=0;e{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{n(t.points)})):t.points&&n(t.points),e}clone(){return new t(Object.assign({},this.attribute))}};const BR=["width","height","cornerRadius",...rE];class IR extends cE{constructor(t){super(t),this.type="rect",this.numberType=RE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{width:t,height:e}=this.attribute;return this._validNumber(t)&&this._validNumber(e)}doUpdateAABBBounds(){const t=fC(this).rect;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRectAABBBounds(e,fC(this).rect,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).rect[t]}needUpdateTags(t){for(let e=0;e{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,n){super.setAttribute(t,e,i,n),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}doUpdateAABBBounds(){this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const t=oM.graphicService.updateGlyphAABBBounds(this.attribute,fC(this).glyph,this._AABBBounds,this);return this.clearUpdateBoundTag(),t}tryUpdateOBBBounds(){throw new Error("暂不支持")}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;const n={},s=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(n,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&s.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,n)=>{i.updateNormalAttrs(s[n]),i.applyStateAttrs(s[n],t,e)})),this.updateNormalAttrs(n),this.currentStates=t,this.applyStateAttrs(n,t,e)}clearStates(t){this.hasState()&&this.normalAttrs&&(this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0),this.normalAttrs=null,this.currentStates=[])}clone(){const t=new FR(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}}class jR{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=n,this.actualHeight=0,this.bottom=e+n,this.right=t+i,this.ellipsis=s,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=lM[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:n}=this.getActualSize(),s=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,n):this.height||n||0;r=Math.min(r,n);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;switch(this.globalAlign){case"left":o=0;break;case"center":o=-s/2;break;case"right":o=-s}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,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 n=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(n=!0,h=!0),this.lines[i].draw(t,n,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=n.actualWidth),e+=n.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:n}=this.getRawActualSize();this.width,this.height;let s=this[this.directionKey.height];if(this.singleLine&&(s=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=s&&0!==s)for(let i=0;ithis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();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((s-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]+s||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(n+rthis[this.directionKey.top]+s);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+s){const n=this.lines[i].getWidthWithEllips();n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class zR{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic","number"==typeof i.lineHeight?this.lineHeight=i.lineHeight>this.fontSize?i.lineHeight:this.fontSize:this.lineHeight=Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:s,descent:r,width:a}=vM(t,i);let o=0,l=0,h=0;this.height>s&&(o=(this.height-s)/2,l=Math.ceil(o),h=Math.floor(o)),"top"===this.textBaseline?(this.ascent=o,this.descent=s-o):"bottom"===this.textBaseline?(this.ascent=s-o,this.descent=o):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+l,this.descent=r+h),this.length=t.length,this.width=a||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height)}updateWidth(){const{width:t}=vM(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,n,s){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r="...",o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+="...","right"===s&&(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=gM(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+="...","right"===s){const{width:e}=vM(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0),this.character.stroke&&(function(t,e){const i=e&&e.stroke||cM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.lineWidth=1,t.strokeStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),t.strokeText(r,a,e)),function(t,e){const i=e&&e.fill||hM;if(!i)return void(t.globalAlpha=0);t.globalAlpha=1,t.fillStyle=i;let n=e.fontSize||16;switch(e.script){case"super":case"sub":n*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:n,fontFamily:e.fontFamily||"sans-serif"})}(t,this.character),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=gM(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+="...";const{width:n}=vM(this.text.slice(t),this.character);return i+this.ellipsisWidth-n}return i}}const HR=["width","height","image",...rE];class NR extends cE{constructor(t){super(t),this.type="image",this.numberType=ME,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}doUpdateAABBBounds(){const t=fC(this).image;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateImageAABBBounds(e,fC(this).image,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return rM[t]}needUpdateTags(t){for(let e=0;e{if(f(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=JC(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=rM.width,height:e=rM.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:n=e}=this.attribute,s=(i-t)/2,r=(n-e)/2;return this._AABBBounds.expand([0,2*s,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class WR{constructor(t,e,i,n,s,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=n,this.descent=s,this.top=i-n,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof VR?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=lM[this.direction];const l=this.directionKey;this.actualWidth=0;let h=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof zR){const e=pM.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],h=Math.max(t[this.directionKey.height],h)})),this.height=h,this.blankWidth=o?0:this.width-this.actualWidth;let c=this.left,d=0;if(this.actualWidth=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add";break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}}this.paragraphs.map(((e,r)=>{if(e instanceof VR)return e.setAttributes({x:i+e._x,y:n+e._y}),void s(e,t,i+e._x,n+e._y,this.ascent);e.draw(t,n+this.ascent,i,0===r,this.textAlign)}))}getWidthWithEllips(){let t=0;for(let e=this.paragraphs.length-1;e>=0;e--){const i=this.paragraphs[e];if(i instanceof VR)break;const{width:n}=vM("...",i.character),s=n||0;if(s<=this.blankWidth+t){i.ellipsis="add",i.ellipsisWidth=s;break}if(s<=this.blankWidth+t+i.width){i.ellipsis="replace",i.ellipsisWidth=s,i.ellipsisOtherParagraphWidth=this.blankWidth+t;break}i.ellipsis="hide",t+=i.width}let e=0;return this.paragraphs.map(((t,i)=>{e+=t instanceof VR?t.width:t.getWidthWithEllips(this.direction)})),e}}class GR{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=lM[this.direction]}store(t){if(t instanceof VR){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 WR(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){t instanceof VR?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t)))}cut(t){const e=this[this.directionKey.width]-this.lineWidth||0,i=Math.ceil(e/t[this.directionKey.width]*t.length)||0,n=gM(t.text,e,t.character,i,"break-word"===this.frame.wordBreak);if(0!==n){const[e,i]=function(t,e){const i=t.text.slice(0,e),n=t.text.slice(e);return[new zR(i,t.newLine,t.character),new zR(n,!0,t.character)]}(t,n);this.store(e),this.deal(i)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const UR=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection",...rE];class YR extends cE{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=BE}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.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:sM.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}doUpdateAABBBounds(){const t=fC(this).richtext;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateRichTextAABBBounds(e,fC(this).richtext,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return sM[t]}needUpdateTags(t){for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=i.id,p.push(t)}}else if(e[t].text.includes("\n")){const i=e[t].text.split("\n");for(let n=0;ni)?i:s)||0,("number"==typeof n&&(!r||r>n)?n:r)||0,a,o,l,h,c,d||"horizontal","number"==typeof i&&(!s||s>i),"number"==typeof n&&(!r||r>n),u||!1,null===(t=this._frameCache)||void 0===t?void 0:t.icons),f=new GR(g);for(let t=0;t{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{var e,i,n,s,r;const a=this.pickIcon(t.global);a&&a===this._currentHoverIcon||(a?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=a,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(a.attribute.cursor),null===(n=this.stage)||void 0===n||n.renderNextFrame()):!a&&this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(s=this.stage)||void 0===s||s.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame()))})),this.addEventListener("pointerleave",(t=>{var e,i;this._currentHoverIcon&&(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(e=this.stage)||void 0===e||e.setCursor(),null===(i=this.stage)||void 0===i||i.renderNextFrame())}))}pickIcon(t){const e=this.getFrameCache(),{e:i,f:n}=this.globalTransMatrix;let s;return e.icons.forEach((e=>{var r,a;e.AABBBounds.containsPoint({x:t.x-i,y:t.y-n})&&(s=e,s.globalX=(null!==(r=s.attribute.x)&&void 0!==r?r:0)+i,s.globalY=(null!==(a=s.attribute.y)&&void 0!==a?a:0)+n)})),s}}const XR=["path","customPath",...rE];class $R extends cE{constructor(t){super(t),this.type="path",this.numberType=TE}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=fC(this).path;if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Dk?e.path:(l(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Dk?this.cache:t.path)}doUpdateAABBBounds(){const t=fC(this).path;this.doUpdatePathShape(),this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePathAABBBounds(e,fC(this).path,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),i}doUpdatePathShape(){const t=this.attribute;g(t.path,!0)?this.cache=(new Dk).fromString(t.path):t.customPath&&(this.cache=new Dk,t.customPath(this.cache,this))}tryUpdateOBBBounds(){throw new Error("暂不支持")}getDefaultAttribute(t){return fC(this).path[t]}needUpdateTags(t){for(let e=0;e{if(e&&e.length){let i=!0;const n=[];if(e.forEach((e=>{var s,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),n.push({x:null!==(s=e.x1)&&void 0!==s?s:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),n.length){for(let e=n.length-1;e>=0;e--)t.lineTo(n[e].x,n[e].y);t.closePath()}}};return e.points?n(e.points):i&&i.length&&i.forEach((t=>{n(t.points)})),t}clone(){return new qR(Object.assign({},this.attribute))}}const ZR=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...rE];class JR extends cE{constructor(t){super(t),this.type="arc",this.numberType=bE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:n}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(n)}getParsedCornerRadius(){const t=fC(this).arc,{cornerRadius:e=t.cornerRadius,outerRadius:i=t.outerRadius,innerRadius:n=t.innerRadius}=this.attribute;if(0===e||"0%"===e)return 0;const s=Math.abs(i-n);return Math.min(y(e,!0)?e:s*parseFloat(e)/100,s/2)}getParsedAngle(){const t=fC(this).arc;let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:n=t.cap}=this.attribute,s=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,n&&Et(r)At&&o>At)return{startAngle:e-s*c*r,endAngle:i+s*c*a,sc:s*c*r,ec:s*c*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=fC(this).arc,{outerRadius:n=i.outerRadius,innerRadius:s=i.innerRadius,padAngle:r=i.padAngle}=this.attribute,{padRadius:a=Dt(n*n+s*s)}=this.attribute,o=Et(e-t);let l=t,h=e,c=t,d=e;const u=r/2;let p=o,g=o;if(u>At&&a>At){const i=e>t?1:-1;let r=jt(Number(a)/s*It(u)),o=jt(Number(a)/n*It(u));return(p-=2*r)>At?(r*=i,c+=r,d-=r):(p=0,c=d=(t+e)/2),(g-=2*o)>At?(o*=i,l+=o,h-=o):(g=0,l=h=(t+e)/2),{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}return{outerStartAngle:l,outerEndAngle:h,innerStartAngle:c,innerEndAngle:d,innerDeltaAngle:p,outerDeltaAngle:g}}doUpdateAABBBounds(t){const e=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const i=this.attribute,n=oM.graphicService.updateArcAABBBounds(i,fC(this).arc,this._AABBBounds,t,this),{boundsPadding:s=e.boundsPadding}=i,r=JC(s);return r&&n.expand(r),this.clearUpdateBoundTag(),n}tryUpdateOBBBounds(){throw new Error("暂不支持")}needUpdateTags(t){for(let e=0;ee;if(s=Tt-At)o.moveTo(0+s*Rt(e),0+s*It(e)),o.arc(0,0,s,e,i,!a),n>At&&(o.moveTo(0+n*Rt(i),0+n*It(i)),o.arc(0,0,n,i,e,a));else{const t=s*Rt(e),r=s*It(e),l=n*Rt(i),h=n*It(i);o.moveTo(0+t,0+r),o.arc(0,0,s,e,i,!a),o.lineTo(0+l,0+h),o.arc(0,0,n,i,e,a),o.closePath()}return o}clone(){return new JR(Object.assign({},this.attribute))}}class QR extends JR{constructor(t){super(t),this.type="arc3d",this.numberType=xE}doUpdateAABBBounds(){const t=fC(this).arc;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updateArc3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}}const tO=["points","cornerRadius",...rE];class eO extends cE{constructor(t){super(t),this.type="polygon",this.numberType=EE}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePolygonAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}tryUpdateOBBBounds(){throw new Error("暂不支持")}_interpolate(t,e,i,n,s){"points"===t&&(s.points=nT(i,n,e))}getDefaultAttribute(t){return fC(this).polygon[t]}needUpdateTags(t){for(let e=0;e{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new eO(Object.assign({},this.attribute))}}class iO extends eO{constructor(t){super(t),this.type="pyramid3d",this.numberType=PE}doUpdateAABBBounds(){const t=fC(this).polygon;this._AABBBounds.setValue(1/0,1/0,-1/0,-1/0);const e=this.attribute,i=oM.graphicService.updatePyramid3dAABBBounds(e,fC(this).polygon,this._AABBBounds,this),{boundsPadding:n=t.boundsPadding}=e,s=JC(n);return s&&i.expand(s),this.clearUpdateBoundTag(),this._AABBBounds}findFace(){const{points:t}=this.attribute,e=t.map(((e,i)=>{const n=3===i?t[0]:t[i+1],s=e.x-n.x;return 0===s?0:(e.y-n.y)/s})),i=t.map((t=>({p:t,d:0})));let n=!1,s=0;for(let t=0;t=0;e--){const n=t[e];i.unshift({p:n,d:0})}for(let e=0;e{r.vertices.push([t.p.x,t.p.y,t.d])})),r.polygons.push({polygon:[0,4,5,1],normal:[0,-1,0]}),r.polygons.push({polygon:[7,6,2,3],normal:[0,1,0]}),r.polygons.push({polygon:[0,4,7,3],normal:[-1,0,0]}),r.polygons.push({polygon:[1,5,6,2],normal:[1,0,0]}),r.polygons.push({polygon:[0,1,2,3],normal:[0,0,-1]}),r.polygons.push({polygon:[4,5,6,7],normal:[0,0,1]}),r.edges=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[3,7],[1,5],[2,6]],r}_isValid(){return super._isValid()&&4===this.attribute.points.length}}var nO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sO=class{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(n+r+a/2)}return i}};sO=nO([fA()],sO);var rO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const aO=Symbol.for("RectBoundsContribution");let oO=class extends sO{};oO=rO([fA()],oO);var lO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const hO=Symbol.for("SymbolBoundsContribution");let cO=class extends sO{updateBounds(t,e,i,n){const{outerBorder:s,shadowBlur:r=e.shadowBlur,strokeBoundsBuffer:a=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:n=t.distance,lineWidth:o=t.lineWidth}=s;uE(i,n+r+o/2,!0,a)}return i}};cO=lO([fA()],cO);var dO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uO=Symbol.for("CircleBoundsContribution");let pO=class extends sO{};pO=dO([fA()],pO);var gO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const fO=Symbol.for("ArcBoundsContribution");let vO=class extends sO{};vO=gO([fA()],vO);var mO=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const yO=Symbol.for("PathBoundsContribution");let _O=class extends sO{};_O=mO([fA()],_O);class bO{constructor(){this.pools=[]}static identity(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}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 bO.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--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};function MO(t,e,i){const n=i[0],s=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,v,m;return e===t?(t[12]=e[0]*n+e[4]*s+e[8]*r+e[12],t[13]=e[1]*n+e[5]*s+e[9]*r+e[13],t[14]=e[2]*n+e[6]*s+e[10]*r+e[14],t[15]=e[3]*n+e[7]*s+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],v=e[10],m=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]=v,t[11]=m,t[12]=a*n+c*s+g*r+e[12],t[13]=o*n+d*s+f*r+e[13],t[14]=l*n+u*s+v*r+e[14],t[15]=h*n+p*s+m*r+e[15]),t}function CO(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 TO(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function EO(t,e,i){var n;const{x:s=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:v=e.attribute.anchor,anchor:m}=e.attribute,y=[0,0,0];if(v){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=v[1];y[2]=null!==(n=v[2])&&void 0!==n?n:0}if(function(t){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),MO(t,t,[s+o,r+l,a+h]),MO(t,t,[y[0],y[1],y[2]]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[5]=a*s+c*n,t[6]=o*s+d*n,t[7]=l*s+u*n,t[8]=h*s-r*n,t[9]=c*s-a*n,t[10]=d*s-o*n,t[11]=u*s-l*n}(t,t,g),function(t,e,i){const n=Math.sin(i),s=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*s-h*n,t[1]=a*s-c*n,t[2]=o*s-d*n,t[3]=l*s-u*n,t[8]=r*n+h*s,t[9]=a*n+c*s,t[10]=o*n+d*s,t[11]=l*n+u*s}(t,t,p),MO(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const n=i[0],s=i[1],r=i[2];t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,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=SO.allocate(),n=[0,0];if(m){if("string"==typeof v[0]){const t=parseFloat(v[0])/100,i=e.AABBBounds;n[0]=i.x1+(i.x2-i.x1)*t}else n[0]=v[0];if("string"==typeof v[1]){const t=parseFloat(v[1])/100,i=e.AABBBounds;n[1]=i.x1+(i.x2-i.x1)*t}else n[1]=v[1]}MO(i,i,[n[0],n[1],0]),function(t,e,i){const n=Math.sin(i),s=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*s+h*n,t[1]=a*s+c*n,t[2]=o*s+d*n,t[3]=l*s+u*n,t[4]=h*s-r*n,t[5]=c*s-a*n,t[6]=d*s-o*n,t[7]=u*s-l*n}(i,i,f),MO(i,i,[-n[0],-n[1],0]),TO(t,t,i)}}let PO=class{constructor(t,e,i,n,s,r){this.creator=t,this.rectBoundsContribitions=e,this.symbolBoundsContribitions=i,this.circleBoundsContribitions=n,this.arcBoundsContribitions=s,this.pathBoundsContribitions=r,this.hooks={onAttributeUpdate:new CA(["graphic"]),onSetStage:new CA(["graphic","stage"]),onRemove:new CA(["graphic"]),onAddIncremental:new CA(["graphic","group","stage"]),onClearIncremental:new CA(["graphic","group","stage"]),beforeUpdateAABBBounds:new CA(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new CA(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new $t,this.tempAABBBounds2=new $t}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)}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,n){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,n)}afterUpdateAABBBounds(t,e,i,n,s){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,n,s)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const n=new DA(t);return rk(i.commandList,n,0,0),!0}updateRectAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._rectBoundsContribitions||(this._rectBoundsContribitions=this.rectBoundsContribitions.getContributions()||[]),this._rectBoundsContribitions.length&&this._rectBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)})),this.transformAABBBounds(t,i,e,!1,n),i}updateGroupAABBBounds(t,e,i,n){const{width:s,height:r,path:a,clip:o=e.clip}=t;a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=s&&null!=r&&i.set(0,0,s,r),o||n.forEachChildren((t=>{i.union(t.AABBBounds)}));const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateGlyphAABBBounds(t,e,i,n){return n.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}updateRichTextAABBBounds(t,e,i,n){if(!n)return i;const{width:s=e.width,height:r=e.height,maxWidth:a=e.maxWidth,maxHeight:o=e.maxHeight,textAlign:l=e.textAlign,textBaseline:h=e.textBaseline}=t;if(s>0&&r>0)i.set(0,0,s,r);else{const t=n.getFrameCache(),{width:e,height:l}=t.getActualSize();let h=s||e||0,c=r||l||0;c="number"==typeof o&&c>o?o:c||0,h="number"==typeof a&&h>a?a:h||0,i.set(0,0,h,c)}let c=0;switch(h){case"top":c=0;break;case"middle":c=-i.height()/2;break;case"bottom":c=-i.height()}let d=0;switch(l){case"left":d=0;break;case"center":d=-i.width()/2;break;case"right":d=-i.width()}i.translate(d,c);const u=this.tempAABBBounds1,p=this.tempAABBBounds2;return u.setValue(i.x1,i.y1,i.x2,i.y2),p.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateTextAABBBounds(t,e,i,n){if(!n)return i;const{text:s=e.text}=n.attribute;Array.isArray(s)?n.updateMultilineAABBBounds(s):n.updateSingallineAABBBounds(s);const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2);const{scaleX:o=e.scaleX,scaleY:l=e.scaleY,shadowBlur:h=e.shadowBlur,strokeBoundsBuffer:c=e.strokeBoundsBuffer}=t;if(h){uE(r,h/Math.abs(o+l),!0,c),i.union(r)}return this.combindShadowAABBBounds(i,n),Yt(i,i,n.transMatrix),i}updatePathAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePathAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this._pathBoundsContribitions||(this._pathBoundsContribitions=this.pathBoundsContribitions.getContributions()||[]),this._pathBoundsContribitions.length&&this._pathBoundsContribitions.forEach((a=>{a.updateBounds(t,e,s,n),i.union(s),s.setValue(r.x1,r.y1,r.x2,r.y2)}));const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePathAABBBoundsImprecise(t,e,i,n){if(!n)return i;const s=n.getParsedPathShape();return i.union(s.getBounds()),i}updatePyramid3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;n.findFace().vertices.forEach((t=>{const e=t[0],n=t[1];i.add(e,n)}));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updateArc3dAABBBounds(t,e,i,n){if(!n)return i;const s=n.stage;if(!s||!s.camera)return i;const{outerRadius:r=e.outerRadius,height:a=0}=t,o=r+a;i.setValue(-o,-o,o,o);const l=this.tempAABBBounds1,h=this.tempAABBBounds2;return l.setValue(i.x1,i.y1,i.x2,i.y2),h.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}updatePolygonAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||this.updatePolygonAABBBoundsImprecise(t,e,i,n);const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updatePolygonAABBBoundsImprecise(t,e,i,n){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}updateLineAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i,n):this.updateLineAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateLineAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.forEach((t=>{r.add(t.x,t.y)})),r}updateLineAABBBoundsBySegments(t,e,i,n){const{segments:s=e.segments}=t,r=i;return s.forEach((t=>{t.points.forEach((t=>{r.add(t.x,t.y)}))})),r}updateAreaAABBBounds(t,e,i,n){this.updatePathProxyAABBBounds(i,n)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i,n):this.updateAreaAABBBoundsByPoints(t,e,i,n));const s=this.tempAABBBounds1,r=this.tempAABBBounds2;s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2);const{lineJoin:a=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===a,n),i}updateAreaAABBBoundsByPoints(t,e,i,n){const{points:s=e.points}=t,r=i;return s.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,n){const{segments:s=e.segments}=t,r=i;return s.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}updateCircleAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateCircleAABBBoundsImprecise(t,e,i,s):this.updateCircleAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;return r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._circleBoundsContribitions||(this._circleBoundsContribitions=this.circleBoundsContribitions.getContributions()||[]),this._circleBoundsContribitions.length&&this._circleBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)})),this.transformAABBBounds(t,i,e,!1,s),i}updateCircleAABBBoundsImprecise(t,e,i,n){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i,n){const{startAngle:s=e.startAngle,endAngle:r=e.endAngle,radius:a=e.radius}=t;return r-s>Tt-At?i.set(-a,-a,a,a):eT(s,r,a,i),i}updateArcAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateArcAABBBoundsImprecise(t,e,i,s):this.updateArcAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._arcBoundsContribitions||(this._arcBoundsContribitions=this.arcBoundsContribitions.getContributions()||[]),this._arcBoundsContribitions.length&&this._arcBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateArcAABBBoundsImprecise(t,e,i,n){const{outerRadius:s=e.outerRadius}=t;return i.set(-s,-s,s,s),i}updateArcAABBBoundsAccurate(t,e,i,n){let{outerRadius:s=e.outerRadius,innerRadius:r=e.innerRadius}=t;if(sa){const t=o;o=a,a=t}return s<=At?i.set(0,0,0,0):Math.abs(a-o)>Tt-At?i.set(-s,-s,s,s):(eT(o,a,s,i),eT(o,a,r,i)),i}updateSymbolAABBBounds(t,e,i,n,s){this.updatePathProxyAABBBounds(i,s)||(n?this.updateSymbolAABBBoundsImprecise(t,e,i,s):this.updateSymbolAABBBoundsAccurate(t,e,i,s));const r=this.tempAABBBounds1,a=this.tempAABBBounds2;r.setValue(i.x1,i.y1,i.x2,i.y2),a.setValue(i.x1,i.y1,i.x2,i.y2),this._symbolBoundsContribitions||(this._symbolBoundsContribitions=this.symbolBoundsContribitions.getContributions()||[]),this._symbolBoundsContribitions.length&&this._symbolBoundsContribitions.forEach((n=>{n.updateBounds(t,e,r,s),i.union(r),r.setValue(a.x1,a.y1,a.x2,a.y2)}));const{lineJoin:o=e.lineJoin}=t;return this.transformAABBBounds(t,i,e,"miter"===o,s),i}updateSymbolAABBBoundsImprecise(t,e,i,n){const{size:s=e.size}=t;if(f(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,n){if(!n)return i;const{size:s=e.size}=t;return n.getParsedPath().bounds(s,i),i}updateImageAABBBounds(t,e,i,n){if(!this.updatePathProxyAABBBounds(i,n)){const{width:n=e.width,height:s=e.height}=t;i.set(0,0,n,s)}const s=this.tempAABBBounds1,r=this.tempAABBBounds2;return s.setValue(i.x1,i.y1,i.x2,i.y2),r.setValue(i.x1,i.y1,i.x2,i.y2),this.transformAABBBounds(t,i,e,!1,n),i}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,n,s){const{scaleX:r=i.scaleX,scaleY:a=i.scaleY,stroke:o=i.stroke,shadowBlur:l=i.shadowBlur,lineWidth:h=i.lineWidth,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(o){uE(d,h/Math.abs(r+a),n,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(l){uE(d,l/Math.abs(r+a),n,c),e.union(d)}this.combindShadowAABBBounds(e,s),Yt(e,e,s.transMatrix)}};PO=wO([fA(),kO(0,yA(FE)),kO(1,yA(wA)),kO(1,vA(aO)),kO(2,yA(wA)),kO(2,vA(hO)),kO(3,yA(wA)),kO(3,vA(uO)),kO(4,yA(wA)),kO(4,vA(fO)),kO(5,yA(wA)),kO(5,vA(yO)),AO("design:paramtypes",[Object,Object,Object,Object,Object,Object])],PO);class RO extends zE{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}const OO=["heightLimit","lineClamp"];class BO extends NP{_isValid(){const{text:t}=this.attribute;return f(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}updateMultilineAABBBounds(t){var e,i,n;const s=fC(this).text,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,lineHeight:h=this.attribute.lineHeight||this.attribute.fontSize||s.fontSize,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,lineWidth:p=s.lineWidth,heightLimit:g=0,lineClamp:f}=this.attribute;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 v=oM.graphicUtil.textMeasure,m=new zP(r,{fontSize:l},v),y=t.map((t=>t.toString())),_=[],b=[0,0];let x=1/0;if(g>0&&(x=Math.max(Math.floor(g/h),1)),f&&(x=Math.min(x,f)),"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 n=0,s=y.length;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let JO=class{transform(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=t.transMatrix,{x:r=e.x,y:a=e.y,z:o=e.z,scaleX:l=e.scaleX,scaleY:h=e.scaleY,angle:c=e.angle,postMatrix:d}=t.attribute,u=s.onlyTranslate()&&!d,p=i.modelMatrix,g=i.camera,f={x:r,y:a,z:o,lastModelMatrix:p},v=g&&(n||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t));if(v){const n=SO.allocate(),s=SO.allocate();EO(s,t,e),TO(n,p||n,s),f.x=0,f.y=0,f.z=0,i.modelMatrix=n,i.setTransform(1,0,0,1,0,0,!0),SO.free(s)}if(u&&!p){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,f.z=o,i.setTransformForCurrent()}else if(v)f.x=0,f.y=0,f.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(g&&i.project){const n=t.getOffsetXY(e);f.x+=n.x,f.y+=n.y,this.transformWithoutTranslate(i,f.x,f.y,f.z,l,h,c)}else i.transformFromMatrix(t.transMatrix,!0),f.x=0,f.y=0,f.z=0;return f}transformUseContext2d(t,e,i,n){const s=n.camera;if(this.camera=s,s){const e=t.AABBBounds,s=e.x2-e.x1,r=e.y2-e.y1,a=n.project(0,0,i),o=n.project(s,0,i),l=n.project(s,r,i),h={x:0,y:0},c={x:s,y:0},d={x:s,y:r};n.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,v=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,m=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;n.setTransform(p,g,f,v,m,y,!0)}}restoreTransformUseContext2d(t,e,i,n){this.camera&&(n.camera=this.camera)}transformWithoutTranslate(t,e,i,n,s,r,a){const o=t.project(e,i,n);t.translate(o.x,o.y,!1),t.scale(s,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}};function QO(t,e,i,n,s){var r;const{offsetX:a=0,offsetY:o=0,offsetZ:l=0,mode:h="none",drawConnect:c=!1,zeroX:d=0,zeroY:u=0}=s||{};if(c&&"none"===h)return;if(!e)return;let p=!0;const{curves:g}=e;if(i>=1){if(c){let e,i=!0;g.forEach(((n,s)=>{var r;let h=n.p0;if(n.originP1!==n.originP2){if(e&&e.originP1===e.originP2&&(h=e.p0),n.defined)i||(t.lineTo(h.x+a,h.y+o,l),i=!i);else{const{originP1:e,originP2:s}=n;let c;if(e&&!1!==e.defined?c=h:e&&!1!==s.defined&&(c=null!==(r=n.p3)&&void 0!==r?r:n.p1),i){i=!i;const e=c?c.x:n.p0.x,s=c?c.y:n.p0.y;t.moveTo(e+a,s+o,l)}else c&&(i=!i,t.lineTo(c.x+a,c.y+o,l))}e=n}else e=n}))}else g.forEach((e=>{e.defined?(p&&t.moveTo(e.p0.x+a,e.p0.y+o,l),tB(t,e,1,s),p=!1):p=!0}));return}if(i<=0)return;let f;"x"===n?f=JA.ROW:"y"===n?f=JA.COLUMN:"auto"===n&&(f=e.direction);const v=i*e.tryUpdateLength(f);let m=0,y=!0,_=null;for(let e=0,i=g.length;e=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let iB=class extends JO{constructor(){super(...arguments),this.numberType=CE}draw(t,e,i,n){const{context:s}=i;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).line,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){var v,m,y,_,b;if(!e)return;t.beginPath();const x=null!==(v=this.z)&&void 0!==v?v:0;QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!f(u.cache)&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:S=0,x:w=0}=a;!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,a,S-c,w-d,o),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,w-d,o),t.stroke()));let{connectedType:A,connectedX:k,connectedY:M,connectedStyle:C}=a;if(f(o)?(A=null!==(m=null!=A?A:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,k=null!==(y=null!=k?k:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,M=null!==(_=null!=M?M:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,k=null!=k?k:o.connectedX,M=null!=M?M:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),QO(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:k,zeroY:M});const v=[];f(o)?o.forEach((t=>v.push(t))):v.push(o),v.push(a),!1!==i&&(p?p(t,a,o):s&&(t.setCommonStyle(u,C,S-c,w-d,v),t.fill())),!1!==n&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,w-d,v),t.stroke()))}return!1}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).line,{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,strokeOpacity:p=l.strokeOpacity,lineWidth:g=l.lineWidth,visible:f=l.visible}=t.attribute,v=sP(d,u,h),m=aP(d,p),y=iP(h),_=nP(c,g);if(!t.valid||!f)return;if(!y&&!_)return;if(!(v||m||a||o))return;if(t.shouldUpdateShape()){const{points:e,segments:i,closePath:n}=t.attribute;let{curveType:s=l.curveType}=t.attribute;n&&"linear"===s&&(s="linearClosed");const r=e;if(i&&i.length){let e,n;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(n={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:n.endX,y:n.endY,defined:n.curves[n.curves.length-1].defined}:i>1&&(e.x=n.endX,e.y=n.endY,e.defined=n.curves[n.curves.length-1].defined);const r=Ik(t.points,s,{startPoint:e});return n=r,r})).filter((t=>!!t)),"linearClosed"===s){let e;for(let i=0;it.points.length));if(1===s[0].points.length&&s.shift(),1===b){let r=!1;t.cache.forEach(((d,g)=>{r||(r=this.drawSegmentItem(e,d,!!h,!!c,u,p,s[g],[l,t.attribute],b,x,i,n,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),d=b*r;let g=0,f=!1;t.cache.forEach(((r,v)=>{if(f)return;const m=r.getLength(),y=(d-g)/m;g+=m,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,p,s[v],[l,t.attribute],Bt(y,1),x,i,n,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,p,t.attribute,l,b,x,i,n,t,a,o)}};function nB(t,e,i,n){if(e.length<2)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0,mode:o}=n||{};let l=e[0];t.moveTo(l.p0.x+s,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+s,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+s,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+s,h.y+r,a),t.closePath()}function sB(t,e,i,n){const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+s,e.p0.y+r,a),rB(t,e,1,n),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+s,l.p0.y+r,a),rB(t,l,1,n),o=!1):o=!0}t.closePath()}function rB(t,e,i,n){if(!e.p1)return;const{offsetX:s=0,offsetY:r=0,offsetZ:a=0}=n||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(s+e.p1.x,r+e.p1.y,s+e.p2.x,r+e.p2.y,s+e.p3.x,r+e.p3.y,a):t.lineTo(s+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[n]=ck(e,i);t.bezierCurveTo(s+n.p1.x,r+n.p1.y,s+n.p2.x,r+n.p2.y,s+n.p3.x,r+n.p3.y,a)}else{const n=e.getPointAt(i);t.lineTo(s+n.x,r+n.y,a)}}iB=eB([fA()],iB);var aB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lB=function(t,e){return function(i,n){e(i,n,t)}};function hB(t,e,i){switch(e){case"linear":default:return yk(t,i);case"basis":return xk(t,i);case"monotoneX":return Tk(t,i);case"monotoneY":return Ek(t,i);case"step":return Rk(t,.5,i);case"stepBefore":return Rk(t,0,i);case"stepAfter":return Rk(t,1,i);case"linearClosed":return Bk(t,i)}}let cB=class{constructor(t){this.areaRenderContribitions=t,this.numberType=SE}drawShape(t,e,i,n,s,r,a,o){var l,h,c,d,u,p;const g=fC(t,null==r?void 0:r.theme).area,{fill:f=g.fill,fillOpacity:v=g.fillOpacity,opacity:m=g.opacity,visible:y=g.visible,z:_=g.z,background:b,stroke:x=t.attribute.stroke,lineWidth:S=g.lineWidth,strokeOpacity:w=g.strokeOpacity}=t.attribute,A=sP(m,v,f),k=iP(f,b),M=nP(x,S),C=aP(m,w);if(!t.valid||!y)return;if(!k&&!M)return;if(!(A||a||C||o))return;const{clipRange:T=g.clipRange}=t.attribute;if(t.shouldUpdateShape()){const{points:e,segments:i,curveType:n=g.curveType}=t.attribute;if(i&&i.length){let e,s;const r=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}),null;1===i?e={x:s.endX,y:s.endY}:i>1&&(e.x=s.endX,e.y=s.endY);const r=hB(t.points,n,{startPoint:e});return s=r,r})).filter((t=>!!t));let a;const o=[];for(let t=i.length-1;t>=0;t--){const e=i[t].points,s=[];for(let t=e.length-1;t>=0;t--)s.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=i[t-1].points,n=e[e.length-1];n&&s.push({x:null!==(c=n.x1)&&void 0!==c?c:n.x,y:null!==(d=n.y1)&&void 0!==d?d:n.y})}a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n),o.unshift(a)}t.cacheArea=o.map(((t,e)=>({top:r[e],bottom:t})))}else{if(!e||!e.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const i=e,s=[];for(let t=e.length-1;t>=0;t--)s.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 r=hB(i,n),a=hB(s,"stepBefore"===n?"stepAfter":"stepAfter"===n?"stepBefore":n);t.cacheArea={top:r,bottom:a}}}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,k,v,M,w,r[c],[g,t.attribute],T,i,n,_,t,s,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*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,M,w,r[u],[g,t.attribute],Bt(f,1),i,n,_,t,s,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,M,w,t.attribute,g,T,i,n,_,t,s,a,o)}draw(t,e,i,n){const{context:s}=i,r=fC(t,null==n?void 0:n.theme).area;let{x:a=r.x,y:o=r.y}=t.attribute;if(s.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f){let v=!1;return v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!1,g,f),v=v||this._drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,!0,g,f),v}_drawSegmentItem(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,v,m){var y,_,b,x;let{connectedType:S,connectedX:w,connectedY:A,connectedStyle:k}=a;const M=[];if(g&&(f(o)?(S=null!==(y=null!=S?S:o[0].connectedType)&&void 0!==y?y:o[1].connectedType,w=null!==(_=null!=w?w:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,k=null!==(x=null!=k?k:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,w=null!=w?w:o.connectedX,A=null!=A?A:o.connectedY,k=null!=k?k:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),f(o)?o.forEach((t=>M.push(t))):M.push(o),M.push(a)),g&&"none"===S)return!1;if(!e)return;t.beginPath();const{points:C,segments:T}=u.attribute;let E,P,R=JA.ROW;if(T){const t=T[T.length-1];P=T[0].points[0],E=t.points[t.points.length-1]}else P=C[0],E=C[C.length-1];R=Et(E.x-P.x)>Et(E.y-P.y)?JA.ROW:JA.COLUMN,function(t,e,i,n){var s;const{drawConnect:r=!1,mode:a="none"}=n||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(i>=1){const e=[],i=[];let s=!0;if(r){let s,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return s=o,void(r=d);if(s&&s.originP1===s.originP2&&(u=s,p=r),o.defined)a||(e.push(u),i.push(p),nB(t,e,i,n),e.length=0,i.length=0,a=!a);else{const{originP1:s,originP2:r}=o;let l,h;s&&!1!==s.defined?(l=u,h=p):s&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),nB(t,e,i,n),e.length=0,i.length=0)}s=o})),nB(t,e,i,n)}else{for(let r=0,a=o.curves.length;rp?JA.ROW:JA.COLUMN,Number.isFinite(u)||(h=JA.COLUMN),Number.isFinite(p)||(h=JA.ROW);const g=i*(h===JA.ROW?u:p);let f=0,v=!0;const m=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;ee.order-t.order))),this._areaRenderContribitions.forEach((e=>{e.time===tk.beforeFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),t.setShadowStyle&&t.setShadowStyle(u,a,o);const{x:O=0,x:B=0}=a;if(!1!==i&&(v?v(t,a,o):n&&(t.setCommonStyle(u,g?k:a,O-h,B-c,g?M:o),t.fill())),this._areaRenderContribitions||(this._areaRenderContribitions=this.areaRenderContribitions.getContributions()||[]),this._areaRenderContribitions.forEach((e=>{e.time===tk.afterFillStroke&&e.drawShape(u,t,h,c,!!n,!1,i,!1,o,p,v,null,{attribute:a})})),!1!==s)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;f(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),QO(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===JA.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:w,zeroY:A})),t.setStrokeStyle(u,g?k:a,O-h,B-c,g?M:o),t.stroke()}return!1}};cB=aB([fA(),lB(0,yA(wA)),lB(0,vA(vP)),oB("design:paramtypes",[Object])],cB);var dB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},pB=function(t,e){return function(i,n){e(i,n,t)}};let gB=class extends JO{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=TE}drawShape(t,e,i,n,s,r,a,o){var l,h;const c=fC(t,null==r?void 0:r.theme).path,{fill:d=c.fill,stroke:u=c.stroke,fillOpacity:p=c.fillOpacity,strokeOpacity:g=c.strokeOpacity,opacity:f=c.opacity,background:v,lineWidth:m=c.lineWidth,visible:y=c.visible,x:_=c.x,y:b=c.y}=t.attribute,x=null!==(l=this.z)&&void 0!==l?l:0,S=sP(f,p,d),w=aP(f,g),A=iP(d,v),k=nP(u,m);if(t.valid&&y&&(A||k)&&(S||w||a||o||v)){if(e.beginPath(),t.pathShape)rk(t.pathShape.commandList,e,i,n,1,1,x);else{rk((null!==(h=t.attribute.path)&&void 0!==h?h:c.path).commandList,e,i,n,1,1,x)}this._pathRenderContribitions||(this._pathRenderContribitions=this.pathRenderContribitions.getContributions()||[],this._pathRenderContribitions.sort(((t,e)=>e.order-t.order))),this._pathRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,c),k&&(o?o(e,t.attribute,c):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-n,c),e.stroke())),A&&(a?a(e,t.attribute,c):S&&(e.setCommonStyle(t,t.attribute,_-i,b-n,c),e.fill())),this._pathRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,c,s,a,o)}))}}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).path,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};gB=dB([fA(),pB(0,yA(wA)),pB(0,vA(bP)),uB("design:paramtypes",[Object])],gB);const fB=kt/2;function vB(t,e,i,n,s,r){let a;if(y(r,!0))a=[r,r,r,r];else if(Array.isArray(r)){const t=r;switch(t.length){case 0:a=[0,0,0,0];break;case 1:a=[t[0],t[0],t[0],t[0]];break;case 2:case 3:a=[t[0],t[1],t[0],t[1]];break;default:a=t.slice(0,5)}}else a=[0,0,0,0];if(n<0||Math.abs(a[0])+Math.abs(a[1])+Math.abs(a[2])+Math.abs(a[3])<1e-12)return t.rect(e,i,n,s);const[o,l,h,c]=[[e,i],[e+n,i],[e+n,i+s],[e,i+s]],d=Math.min(n/2,s/2),u=[Math.min(d,a[0]),Math.min(d,a[1]),Math.min(d,a[2]),Math.min(d,a[3])],p=[o[0]+u[0],o[1]],g=[o[0],o[1]+u[0]],f=[l[0]-u[1],l[1]],v=[l[0],l[1]+u[1]],m=[h[0]-u[2],h[1]],_=[h[0],h[1]-u[2]],b=[c[0]+u[3],c[1]],x=[c[0],c[1]-u[3]];if(t.moveTo(p[0],p[1]),t.lineTo(f[0],f[1]),!U(f,v)){const e=f[0],i=f[1]+u[1];t.arc(e,i,u[1],-fB,0,!1)}if(t.lineTo(_[0],_[1]),!U(m,_)){const e=_[0]-u[2],i=_[1];t.arc(e,i,u[2],0,fB,!1)}if(t.lineTo(b[0],b[1]),!U(b,x)){const e=b[0],i=b[1]-u[3];t.arc(e,i,u[3],fB,kt,!1)}if(t.lineTo(g[0],g[1]),!U(p,g)){const e=p[0],i=p[1]+u[0];t.arc(e,i,u[0],kt,kt+fB,!1)}return t.closePath(),t}var mB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_B=function(t,e){return function(i,n){e(i,n,t)}};let bB=class{constructor(t){this.rectRenderContribitions=t,this.type="rect",this.numberType=RE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).rect,{fill:h=l.fill,background:c,stroke:d=l.stroke,width:u=l.width,height:p=l.height,cornerRadius:g=l.cornerRadius,opacity:v=l.opacity,fillOpacity:m=l.fillOpacity,lineWidth:y=l.lineWidth,strokeOpacity:_=l.strokeOpacity,visible:b=l.visible,x:x=l.x,y:S=l.y}=t.attribute,w=rP(v,m,u,p,h),A=oP(v,_,u,p),k=iP(h,c),M=nP(d,y);if(!t.valid||!b)return;if(!k&&!M)return;if(!(w||A||a||o||c))return;0===g||f(g)&&g.every((t=>0===t))?(e.beginPath(),e.rect(i,n,u,p)):(e.beginPath(),vB(e,i,n,u,p,g)),this._rectRenderContribitions||(this._rectRenderContribitions=this.rectRenderContribitions.getContributions()||[],this._rectRenderContribitions.sort(((t,e)=>e.order-t.order)));const C={doFill:k,doStroke:M};this._rectRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,x-i,S-n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,x-i,S-n,l),e.stroke())),this._rectRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).rect;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};bB=mB([fA(),_B(0,yA(wA)),_B(0,vA(SP)),yB("design:paramtypes",[Object])],bB);var xB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},SB=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wB=function(t,e){return function(i,n){e(i,n,t)}};let AB=class extends JO{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=IE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).symbol,{size:c=h.size,fill:d=h.fill,background:u,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,stroke:m=h.stroke,visible:y=h.visible,x:_=h.x,y:b=h.y,scaleX:x=h.scaleX,scaleY:S=h.scaleY}=t.attribute,w=sP(f,p,d),A=aP(f,g),k=iP(d,u),M=nP(m,v);if(!t.valid||!y)return;if(!k&&!M)return;if(!(w||A||a||o||u))return;const C=t.getParsedPath();if(!C)return;const{keepDirIn3d:T=h.keepDirIn3d}=t.attribute,E=null!==(l=this.z)&&void 0!==l?l:0;if(e.beginPath(),T&&e.camera&&e.project){const t=e.project(i,n,E),s=e.camera;e.camera=null,!1===C.draw(e,c,t.x,t.y)&&e.closePath(),e.camera=s}else!1===C.draw(e,c,i,n,E)&&e.closePath();this._symbolRenderContribitions||(this._symbolRenderContribitions=this.symbolRenderContribitions.getContributions()||[],this._symbolRenderContribitions.sort(((t,e)=>e.order-t.order))),this._symbolRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),k&&(a?a(e,t.attribute,h):w&&(e.setCommonStyle(t,t.attribute,_-i,b-n,h),e.fill())),M&&(o?o(e,t.attribute,h):A&&(e.setStrokeStyle(t,t.attribute,(_-i)/x,(b-n)/S,h),e.stroke())),this._symbolRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).symbol,a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.highPerformanceRestore()}};AB=xB([fA(),wB(0,yA(wA)),wB(0,vA(wP)),SB("design:paramtypes",[Object])],AB);var kB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},CB=function(t,e){return function(i,n){e(i,n,t)}};let TB=class extends JO{constructor(t){super(),this.textRenderContribitions=t,this.numberType=DE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).text,{text:c,fill:d=h.fill,stroke:u=h.stroke,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,opacity:f=h.opacity,lineWidth:v=h.lineWidth,visible:m=h.visible,underline:y=h.underline,lineThrough:_=h.lineThrough,keepDirIn3d:b=h.keepDirIn3d,direction:x=h.direction,fontSize:S=h.fontSize,textBaseline:w=h.textBaseline,textAlign:A=h.textAlign,x:k=h.x,y:M=h.y}=t.attribute,C=null!==(l=t.attribute.lineHeight)&&void 0!==l?l:S,T=sP(f,p,d),E=aP(f,g),P=iP(d),R=nP(u,v);if(!t.valid||!m)return;if(!(P||R||T||E))return;const O=!b,B=this.z||0;if(e.beginPath(),!this._textBeforeRenderContribitions){const t=this.textRenderContribitions.getContributions()||[];t.sort(((t,e)=>e.order-t.order)),this._textBeforeRenderContribitions=[],this._textAfterRenderContribitions=[],t.forEach((t=>{t.time===tk.beforeFillStroke?this._textBeforeRenderContribitions.push(t):this._textAfterRenderContribitions.push(t)}))}this._textBeforeRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),O&&this.transformUseContext2d(t,h,B,e);const I=(s,r,l,c)=>{let d=i+r;const u=n+l;if(c){e.highPerformanceSave(),d+=S;const t=xO.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,d,u),e.transformFromMatrix(t,!0),xO.free(t)}R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),e.strokeText(s,d,u,B))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),e.fillText(s,d,u,B),this.drawUnderLine(y,_,t,d,u,B,h,e))),c&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(Array.isArray(c))if(e.setTextStyleWithoutAlignBaseline(t.attribute,h,B),"horizontal"===x){const{multilineLayout:s}=t;if(!s)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=s.bbox;R&&(o?o(e,t.attribute,h):E&&(e.setStrokeStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+n,B)})))),P&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,k-i,M-n,h),s.lines.forEach((s=>{e.fillText(s.str,(s.leftOffset||0)+r+i,(s.topOffset||0)+l+n,B),this.drawMultiUnderLine(y,_,t,(s.leftOffset||0)+i,(s.topOffset||0)+l+n,B,s.width,h,e)}))))}else{const i=t.cache,{verticalList:n}=i;e.textAlign="left",e.textBaseline="top";const s=C*n.length;let r=0;n.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Ot(e,r)}));let a=0,o=0;"bottom"===w?o=-s:"middle"===w&&(o=-s/2),"center"===A?a-=r/2:"right"===A&&(a-=r),n.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),n=r-i;let l=a;"center"===A?l+=n/2:"right"===A&&(l+=n),t.forEach((t=>{const{text:i,width:n,direction:r}=t;I(i,s-(e+1)*C+o,l,r),l+=n}))}))}else{const i=t.cache;if("horizontal"===x){e.setTextStyle(t.attribute,h,B);const i=t.clipedText;let n=0;C!==S&&("top"===w?n=(C-S)/2:"middle"===w||"bottom"===w&&(n=-(C-S)/2)),I(i,0,n,0)}else if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,h,B);const{verticalList:n}=i;let s=0;const r=n[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===w?a=-C:"middle"===w&&(a=-C/2),"center"===A?s-=r/2:"right"===A&&(s-=r),e.textAlign="left",e.textBaseline="top",n[0].forEach((t=>{const{text:e,width:i,direction:n}=t;I(e,a,s,n),s+=i}))}}O&&this.restoreTransformUseContext2d(t,h,B,e),this._textAfterRenderContribitions.forEach((r=>{r.drawShape(t,e,i,n,P,R,T,E,h,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).text,{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.z=d,this.drawShape(t,s,h,c,i,n),this.z=0,s.modelMatrix=u,s.highPerformanceRestore()}drawUnderLine(t,e,i,n,s,r,a,o){if(e+t<=0)return;const{textAlign:l=a.textAlign,textBaseline:h=a.textBaseline,fontSize:c=a.fontSize,fill:d=a.fill,opacity:u=a.opacity,fillOpacity:p=a.fillOpacity}=i.attribute,g=i.clipedWidth,f=FP(l,g),v=jP(h,c,c),m={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};if(t){m.lineWidth=t,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const e=s+v+c;o.moveTo(n+f,e,r),o.lineTo(n+f+g,e,r),o.stroke()}if(e){m.lineWidth=e,o.setStrokeStyle(i,m,n,s,a),o.beginPath();const t=s+v+c/2;o.moveTo(n+f,t,r),o.lineTo(n+f+g,t,r),o.stroke()}}drawMultiUnderLine(t,e,i,n,s,r,a,o,l){if(e+t<=0)return;const{textAlign:h=o.textAlign,fontSize:c=o.fontSize,fill:d=o.fill,opacity:u=o.opacity,fillOpacity:p=o.fillOpacity}=i.attribute,g=FP(h,a),f=jP("alphabetic",c,c),v={lineWidth:0,stroke:d,opacity:u,strokeOpacity:p};let m=-3;if(t){v.lineWidth=t,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const e=s+f+c+m;l.moveTo(n+g,e,r),l.lineTo(n+g+a,e,r),l.stroke()}if(m=-1,e){v.lineWidth=e,l.setStrokeStyle(i,v,n,s,o),l.beginPath();const t=s+f+c/2+m;l.moveTo(n+g,t,r),l.lineTo(n+g+a,t,r),l.stroke()}}};TB=kB([fA(),CB(0,yA(wA)),CB(0,vA(AP)),MB("design:paramtypes",[Object])],TB);var EB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PB=class{};function RB(t,e,i,n){t.moveTo(e[0].x+i,e[0].y+n);for(let s=1;s=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},LB=function(t,e){return function(i,n){e(i,n,t)}};let FB=class{constructor(t){this.polygonRenderContribitions=t,this.numberType=EE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).polygon,{points:h=l.points,fill:c=l.fill,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,fillOpacity:p=l.fillOpacity,background:g,strokeOpacity:v=l.strokeOpacity,lineWidth:m=l.lineWidth,opacity:y=l.opacity,visible:_=l.visible,x:b=l.x,y:x=l.y}=t.attribute,S=sP(y,p,c),w=aP(y,v),A=iP(c,g),k=nP(d,m);t.valid&&_&&(A||k)&&(S||w||a||o||g)&&(e.beginPath(),u<=0||f(u)&&u.every((t=>0===t))?RB(e.camera?e:e.nativeContext,h,i,n):function(t,e,i,n,s){var r;if(e.length<3)RB(t,e,i,n);else for(let a=0;ab&&(m=b,v=b*f);const x=BB(l,m,y,c,d),S=BB(l,m,_,u,p),w=2*l.x-x.x-S.x,A=2*l.y-x.y-S.y,k=OB(w,A),M=BB(l,OB(m,v),k,w,A);let C=Math.atan2(x.y-M.y,x.x-M.x);const T=Math.atan2(S.y-M.y,S.x-M.x);let E=T-C;E<0&&(C=T,E=-E),E>Math.PI&&(E-=Math.PI),0===a?t.moveTo(x.x+i,x.y+n):t.lineTo(x.x+i,x.y+n),E&&t.arcTo(l.x+i,l.y+n,S.x+i,S.y+n,v),t.lineTo(S.x+i,S.y+n)}}(e.camera?e:e.nativeContext,h,i,n,u),e.closePath(),this._polygonRenderContribitions||(this._polygonRenderContribitions=this.polygonRenderContribitions.getContributions()||[],this._polygonRenderContribitions.sort(((t,e)=>e.order-t.order))),this._polygonRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),A&&(a?a(e,t.attribute,l):p&&(e.setCommonStyle(t,t.attribute,b-i,x-n,l),e.fill())),k&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,b-i,x-n,l),e.stroke())),this._polygonRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,A,k,S,w,l,s,a,o)})))}draw(t,e,i,n){const{context:s}=i;if(!s)return;s.highPerformanceSave();const r=fC(t,null==n?void 0:n.theme).polygon;let{x:a=r.x,y:o=r.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(r);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,s.transformFromMatrix(t.transMatrix,!0);lP(t,s,a,o,0,n)||this.drawShape(t,s,a,o,i,n),s.highPerformanceRestore()}};FB=IB([fA(),LB(0,yA(wA)),LB(0,vA(xP)),DB("design:paramtypes",[Object])],FB);var jB=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},HB=function(t,e){return function(i,n){e(i,n,t)}};const NB=["","repeat-x","repeat-y","repeat"];let VB=class{constructor(t){this.imageRenderContribitions=t,this.numberType=ME}drawShape(t,e,i,n,s,r,a){const o=fC(t).image,{fill:l=o.fill,width:h=o.width,height:c=o.height,opacity:d=o.opacity,fillOpacity:u=o.fillOpacity,visible:p=o.visible,repeatX:g=o.repeatX,repeatY:f=o.repeatY,image:v}=t.attribute,m=sP(d,u,l),y=iP(l);if(t.valid&&p&&y&&(m||a)){if(this._imageRenderContribitions||(this._imageRenderContribitions=this.imageRenderContribitions.getContributions()||[]),this._imageRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)})),e.setShadowStyle&&e.setShadowStyle(t,o),y)if(a)a(e,t.attribute,o);else if(m){if(!v||!t.resources)return;const s=t.resources.get(v);if("success"!==s.state)return;e.setCommonStyle(t,t.attribute,i,n,o);let r=0;if("repeat"===g&&(r|=1),"repeat"===f&&(r|=2),r){const t=e.createPattern(s.data,NB[r]);e.fillStyle=t,e.fillRect(i,n,h,c)}else e.drawImage(s.data,i,n,h,c)}this._imageRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,y,!1,m,!1,o,s,a)}))}}draw(t,e,i){const{context:n}=e.drawParams;if(!n)return;const s=fC(t).image;let{x:r=s.x,y:a=s.y}=t.attribute;const{image:o}=t.attribute;if(o&&t.resources&&"success"===t.resources.get(o).state){if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}}};VB=jB([fA(),HB(0,yA(wA)),HB(0,vA(_P)),zB("design:paramtypes",[Object])],VB);const WB=Symbol.for("IncrementalDrawContribution"),GB=Symbol.for("ArcRender"),UB=Symbol.for("Arc3dRender"),YB=Symbol.for("AreaRender"),XB=Symbol.for("CircleRender"),$B=Symbol.for("GraphicRender"),KB=Symbol.for("GroupRender"),qB=Symbol.for("LineRender"),ZB=Symbol.for("PathRender"),JB=Symbol.for("PolygonRender"),QB=Symbol.for("RectRender"),tI=Symbol.for("Rect3DRender"),eI=Symbol.for("SymbolRender"),iI=Symbol.for("TextRender"),nI=Symbol.for("RichTextRender"),sI=Symbol.for("Pyramid3dRender"),rI=Symbol.for("GlyphRender"),aI=Symbol.for("ImageRender"),oI=Symbol.for("RenderSelector"),lI=Symbol.for("DrawContribution");function hI(t,e,i){let n=e;const{a:s,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(s)*Math.sqrt(s*s+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(n=n/Math.abs(l+h)*2*i,n)}function cI(t,e,i,n,s){if(!e||!0===e)return"black";let r,a;if(f(e))for(let t=0;t3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l;const h=i.AABBBounds;if(!h)return;let c=h.x2-h.x1,d=h.y2-h.y1,u=h.x1-n,p=h.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;c/=t,d/=e,u/=t,p/=e}const g=t.createLinearGradient(u+(null!==(r=e.x0)&&void 0!==r?r:0)*c,p+(null!==(a=e.y0)&&void 0!==a?a:0)*d,u+(null!==(o=e.x1)&&void 0!==o?o:1)*c,p+(null!==(l=e.y1)&&void 0!==l?l:0)*d);return e.stops.forEach((t=>{g.addColorStop(t.offset,t.color)})),g}(t,a,i,n,s):"conical"===a.gradient?r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a;const o=i.AABBBounds;if(!o)return;let l=o.x2-o.x1,h=o.y2-o.y1,c=o.x1-n,d=o.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;l/=t,h/=e,c/=t,d/=e}const u=t.createConicGradient(c+(null!==(r=e.x)&&void 0!==r?r:0)*l,d+(null!==(a=e.y)&&void 0!==a?a:0)*h,e.startAngle,e.endAngle);return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u.GetPattern(l+c,h+d,void 0)}(t,a,i,n,s):"radial"===a.gradient&&(r=function(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;var r,a,o,l,h,c;const d=i.AABBBounds;if(!d)return;let u=d.x2-d.x1,p=d.y2-d.y1,g=d.x1-n,f=d.y1-s;if(i.attribute){const{scaleX:t=1,scaleY:e=1}=i.attribute;if(t*e==0)return;g/=t,f/=e,u/=t,p/=e}const v=t.createRadialGradient(g+(null!==(r=e.x0)&&void 0!==r?r:.5)*u,f+(null!==(a=e.y0)&&void 0!==a?a:.5)*p,Math.max(u,p)*(null!==(o=e.r0)&&void 0!==o?o:0),g+(null!==(l=e.x1)&&void 0!==l?l:.5)*u,f+(null!==(h=e.y1)&&void 0!==h?h:.5)*p,Math.max(u,p)*(null!==(c=e.r1)&&void 0!==c?c:.5));return e.stops.forEach((t=>{v.addColorStop(t.offset,t.color)})),v}(t,a,i,n,s)),r||"orange")}const dI=new class{constructor(){this.pools=[]}allocate(t){if(!this.pools.length)return kM(Object.assign({nativeCanvas:oM.global.createCanvas(t)},t));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};return kM(Object.assign({nativeCanvas:oM.global.createCanvas(e)},e))}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(){this.pools=[]}};var uI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gI=function(t,e){return function(i,n){e(i,n,t)}};let fI=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){const{background:p}=t.attribute;if(p)if(t.backgroundImg&&t.resources){const s=t.resources.get(p);if("success"!==s.state||!s.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,n,l),e.drawImage(s.data,r.x1,r.y1,r.width(),r.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=p,e.fill(),e.highPerformanceRestore()}};fI=uI([fA()],fI);let vI=class{constructor(t){this.subRenderContribitions=t,this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,n,s,r,a,o,l,h,c,d,u)}))}};vI=uI([fA(),gI(0,yA(wA)),gI(0,vA(kP)),pI("design:paramtypes",[Object])],vI);let mI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,n,s){const r=(t-2*e)/2,a=dI.allocate({width:t,height:t,dpr:1}),o=a.getContext("2d");if(!o)return null;o.clearRect(0,0,t,t),s(r,o);const l=n.createPattern(a.nativeCanvas,"repeat");return dI.free(a),l}createCirclePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Tt),e.fill()}))}createDiamondPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{const s=t/2,r=s;n.fillStyle=i,n.moveTo(s,r-e),n.lineTo(e+s,r),n.lineTo(s,r+e),n.lineTo(s-e,r),n.closePath(),n.fill()}))}createRectPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(r,0,2*n,t)}))}createHorizontalLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((n,s)=>{const r=e;s.fillStyle=i,s.fillRect(0,r,t,2*n)}))}createBiasLRLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(0,0),n.lineTo(t,t);const s=t/2,r=-s;n.moveTo(s,r),n.lineTo(s+t,r+t),n.moveTo(-s,-r),n.lineTo(-s+t,-r+t),n.stroke()}))}createBiasRLLinePattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((e,n)=>{n.strokeStyle=i,n.lineWidth=e,n.moveTo(t,0),n.lineTo(0,t);const s=t/2,r=s;n.moveTo(t+s,r),n.lineTo(s,r+t),n.moveTo(t-s,-r),n.lineTo(-s,-r+t),n.stroke()}))}createGridPattern(t,e,i,n){return this.createCommonPattern(t,e,i,n,((t,n)=>{const s=e,r=s;n.fillStyle=i,n.fillRect(s,r,t,t),n.fillRect(s+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,n,s,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:v=l.texturePadding}=t.attribute;if(!p)return;let m=this.textureMap.get(p);if(!m)switch(p){case"circle":m=this.createCirclePattern(f,v,g,e);break;case"diamond":m=this.createDiamondPattern(f,v,g,e);break;case"rect":m=this.createRectPattern(f,v,g,e);break;case"vertical-line":m=this.createVerticalLinePattern(f,v,g,e);break;case"horizontal-line":m=this.createHorizontalLinePattern(f,v,g,e);break;case"bias-lr":m=this.createBiasLRLinePattern(f,v,g,e);break;case"bias-rl":m=this.createBiasRLLinePattern(f,v,g,e);break;case"grid":m=this.createGridPattern(f,v,g,e)}m&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=m,e.fill(),e.highPerformanceRestore())}};mI=uI([fA()],mI);var yI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _I=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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{innerRadius:v=l.innerRadius,outerRadius:m=l.outerRadius,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m+r,innerRadius:v-r,startAngle:y-a,endAngle:_+a}),e.beginPath(),dP(t,e,i,n,m+r,v-r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=s/m;if(t.setAttributes({outerRadius:m-r,innerRadius:v+r,startAngle:y+a,endAngle:_-a}),e.beginPath(),dP(t,e,i,n,m-r,v+r),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}t.setAttributes({outerRadius:m,innerRadius:v,startAngle:y,endAngle:_})}};_I=yI([fA()],_I);let bI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};bI=yI([fA()],bI);let xI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};xI=yI([fA()],xI);var SI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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:v=l.radius,startAngle:m=l.startAngle,endAngle:y=l.endAngle,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:w=l.scaleY}=t.attribute,A=!(!u||!u.stroke),k=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v+r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(A){const s=l.outerBorder.opacity;l.outerBorder.opacity=_,e.setStrokeStyle(t,u,(b-i)/S,(x-n)/w,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(f){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),e.arc(i,n,v-r,m,y),e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(k){const s=l.innerBorder.opacity;l.innerBorder.opacity=_,e.setStrokeStyle(t,p,(b-i)/S,(x-n)/w,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};wI=SI([fA()],wI);let AI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};AI=SI([fA()],AI);let kI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};kI=SI([fA()],kI);var MI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let CI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u}=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 n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}};CI=MI([fA()],CI);var TI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let EI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{background:u,width:p,height:g}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=fC(t.parent).group,{scrollX:n=i.scrollX,scrollY:s=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(n,s)}const n=t.AABBBounds;e.drawImage(i.data,n.x1,n.y1,n.width(),n.height()),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else{e.beginPath();const s=t.AABBBounds;e.rect(i,n,s.width(),s.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};EI=TI([fA()],EI);var PI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,v=p&&!1!==p.visible;if(!g&&!v)return;const{width:m=l.width,height:y=l.height,cornerRadius:_=l.cornerRadius,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:w=l.scaleX,scaleY:A=l.scaleY}=t.attribute,k=!(!u||!u.stroke),M=!(!p||!p.stroke);if(g){const{distance:s=l.outerBorder.distance}=u,r=hI(e,s,e.dpr),a=i-r,o=n-r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m+h,y+h)):(e.beginPath(),vB(e,a,o,m+h,y+h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,u,l.outerBorder);else if(k){const s=l.outerBorder.opacity;l.outerBorder.opacity=b,e.setStrokeStyle(t,u,(x-i)/w,(S-n)/A,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=p,r=hI(e,s,e.dpr),a=i+r,o=n+r,h=2*r;if(0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(a,o,m-h,y-h)):(e.beginPath(),vB(e,a,o,m-h,y-h,_)),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.innerBorder);else if(M){const s=l.innerBorder.opacity;l.innerBorder.opacity=b,e.setStrokeStyle(t,p,(x-i)/w,(S-n)/A,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};RI=PI([fA()],RI);let OI=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};OI=PI([fA()],OI);let BI=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};BI=PI([fA()],BI);let II=class{constructor(){this.time=tk.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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)}};II=PI([fA()],II);let DI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,r,a,o,l,h,c,d){const{width:u=l.width,height:p=l.height,stroke:g=l.stroke}=t.attribute;if(Array.isArray(g)&&g.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,n,l),e.beginPath(),e.moveTo(i,n),g[0]?e.lineTo(i+u,n):e.moveTo(i+u,n),g[1]?e.lineTo(i+u,n+p):e.moveTo(i+u,n+p),g[2]?e.lineTo(i,n+p):e.moveTo(i,n+p),g[3]){const t=g[0]?n-e.lineWidth/2:n;e.lineTo(i,t)}else e.moveTo(i,n);e.stroke()}}};DI=PI([fA()],DI);var LI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let FI=class{constructor(){this.time=tk.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,n,s,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,v=g&&!1!==g.visible;if(!f&&!v)return;const{size:m=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY}=t.attribute,w=!(!p||!p.stroke),A=!(!g||!g.stroke);if(f){const{distance:s=l.outerBorder.distance}=p,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,p,l.outerBorder);else if(w){const s=l.outerBorder.opacity;l.outerBorder.opacity=y,e.setStrokeStyle(t,p,(_-i)/x,(b-n)/S,l.outerBorder),l.outerBorder.opacity=s,e.stroke()}}if(v){const{distance:s=l.innerBorder.distance}=g,r=hI(e,s,e.dpr);if(e.beginPath(),!1===u.drawOffset(e,m,i,n,-r)&&e.closePath(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),d)d(e,g,l.innerBorder);else if(A){const s=l.innerBorder.opacity;l.innerBorder.opacity=y,e.setStrokeStyle(t,g,(_-i)/x,(b-n)/S,l.innerBorder),l.innerBorder.opacity=s,e.stroke()}}}};FI=LI([fA()],FI);class jI extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}}class zI extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}}var HI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NI=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VI=function(t,e){return function(i,n){e(i,n,t)}};const WI=Symbol.for("RenderService");let GI=class{constructor(t){this.drawContribution=t}prepare(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){}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)}};GI=HI([fA(),VI(0,yA(lI)),NI("design:paramtypes",[Object])],GI);var UI=new cA((t=>{t(GI).toSelf(),t(WI).toService(GI)})),YI=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function XI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r={},a=[];let o=!1;if(s)o=!0;else{let i;t.forEachChildren(((t,n)=>{const{zIndex:s=e}=t.attribute;if(0===n)i=s;else if(i!==s)return o=!0,!0;return!1}),n)}if(o){t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;r[i]?r[i].push(t):(r[i]=[t],a.push(i))}),n),a.sort(((t,e)=>n?e-t:t-e));let o=!1;for(let t=0;t{var i,s;return(n?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(s=t.attribute.z)&&void 0!==s?s:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return YI(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,n)}))}function KI(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s={},r=[];let a=!1;t.forEachChildren(((t,e)=>{const{zIndex:n=i}=t.attribute;if(0===e);else if(void 0!==n)return a=!0,!0;return!1}),n);let o=null,l=!1;if(a){t.forEachChildren((t=>{const{zIndex:e=i}=t.attribute;s[e]?s[e].push(t):(s[e]=[t],r.push(e))}),n),r.sort(((t,e)=>n?e-t:t-e));let a=!1;for(let t=0;tl?(o=t,!0):(t._uid===e&&(l=!0),!1)),n);return o}var qI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const ZI=Symbol.for("PickItemInterceptor");let JI=class{constructor(){this.order=1}beforePickItem(t,e,i,n,s){if(!t.in3dMode||n.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(n.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){let a,o=!1,l=!1;if(t.forEachChildren((t=>(o=t.numberType===xE,!o))),t.forEachChildren((t=>(l=!!t.findFace,!l))),o){const r=t.getChildren(),o=[...r];o.sort(((t,e)=>{var i,n,s,r;let a=(null!==(n=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==n?n:0)/2,o=(null!==(r=null!==(s=e.attribute.startAngle)&&void 0!==s?s:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),o.forEach((e=>{t.appendChild(e)})),n.hack_pieFace="outside",a=e.pickGroup(t,i,s.parentMatrix,n),a.graphic||(n.hack_pieFace="inside",a=e.pickGroup(t,i,s.parentMatrix,n)),a.graphic||(n.hack_pieFace="top",a=e.pickGroup(t,i,s.parentMatrix,n)),t.removeAllChild(),r.forEach((t=>{t._next=null,t._prev=null})),r.forEach((e=>{t.appendChild(e)}))}else if(l){const o=t.getChildren(),l=o.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));l.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),l.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),l.forEach((e=>{t.add(e.g)})),a=e.pickGroup(t,i,s.parentMatrix,n),t.removeAllChild(),o.forEach((t=>{t._next=null,t._prev=null})),t.update(),o.forEach((e=>{t.add(e)}))}else a=e.pickGroup(t,i,s.parentMatrix,n);return r.camera=null,r.restore(),n.in3dInterceptor=!1,a}return null}initCanvasCtx(t){t.setTransformForCurrent()}};JI=qI([fA()],JI);var QI=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},eD=function(t,e){return function(i,n){e(i,n,t)}};const iD=Symbol.for("PickerService");let nD=class{constructor(t,e){this.global=t,this.pickItemInterceptorContributions=e,this.type="default"}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let n={graphic:null,group:null};i.pickerService=this;let s=0,r=0;if(i&&i.bounds){if(!i.bounds.contains(e.x,e.y))return n;s=i.bounds.x1,r=i.bounds.y1}this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ee(1,0,0,1,s,r);let o;for(let s=t.length-1;s>=0&&(t[s].isContainer?n=this.pickGroup(t[s],e,a,i):n.graphic=this.pickItem(t[s],e,i),!n.graphic);s--)o||(o=n.group);return n.graphic||(n.group=o),this.pickContext&&(this.pickContext.inuse=!1),n}containsPoint(t,e,i){return!!this.pickItem(t,e,i)}pickGroup(t,e,i,n){let s={group:null,graphic:null};if(!1===t.attribute.visibleAll)return s;const r=n.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=SO.allocate();if(CO(i,e),a){if(i){const t=SO.allocate();r.modelMatrix=TO(t,a,i),SO.free(i)}}else CO(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let s=0;s{if(i.isContainer){const r=new Gt(e.x,e.y),a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h,s=this.pickGroup(i,r,l,n)}else{const r=new Gt(e.x,e.y);l.transformPoint(r,r);const a=fC(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;r.x-=o,r.y-=h;const c=this.pickItem(i,r,n);s.graphic=c}return!!s.graphic||!!s.group}),!0,!!r.camera),r.modelMatrix!==a&&SO.free(r.modelMatrix),r.modelMatrix=a,s.graphic||s.group||!d||t.stage.camera||(s.group=t),xO.free(l),s}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};nD=QI([fA(),eD(0,yA(EA)),eD(1,yA(wA)),eD(1,vA(ZI)),tD("design:paramtypes",[Object,Object])],nD);var sD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},aD=function(t,e){return function(i,n){e(i,n,t)}};const oD=Symbol.for("GlobalPickerService");let lD=class{constructor(t){this.global=t,this.global.hooks.onSetEnv.tap("global-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env)}configure(t,e){}pick(t,e,i){let n={graphic:null,group:null};const s=new ee(1,0,0,1,0,0);let r;for(let a=0;a{if(t.isContainer)s=this.pickGroup(t,e,i,n);else{const r=new Gt(e.x,e.y);i.transformPoint(r,r),s.graphic=this.pickItem(t,r,n)}return!!s.graphic||!!s.group})),s.graphic||s.group||!l||(s.group=t),s}pickItem(t,e,i){return!1===t.attribute.pickable?null:t.AABBBounds.containsPoint(e)?t:null}};function hD(t,e,i){const n=e[0],s=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],v=e[13],m=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*n+b*o+x*d+S*f,t[1]=_*s+b*l+x*u+S*v,t[2]=_*r+b*h+x*p+S*m,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*n+b*o+x*d+S*f,t[5]=_*s+b*l+x*u+S*v,t[6]=_*r+b*h+x*p+S*m,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*n+b*o+x*d+S*f,t[9]=_*s+b*l+x*u+S*v,t[10]=_*r+b*h+x*p+S*m,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*n+b*o+x*d+S*f,t[13]=_*s+b*l+x*u+S*v,t[14]=_*r+b*h+x*p+S*m,t[15]=_*a+b*c+x*g+S*y,t}function cD(t,e,i){const n=e[0],s=e[1],r=e[2];let a=i[3]*n+i[7]*s+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*s+i[8]*r+i[12])/a,t[1]=(i[1]*n+i[5]*s+i[9]*r+i[13])/a,t[2]=(i[2]*n+i[6]*s+i[10]*r+i[14])/a,t}lD=sD([fA(),aD(0,yA(EA)),rD("design:paramtypes",[Object])],lD);class dD{set params(t){this._params=Object.assign({},t),this._projectionMatrixCached=this.forceGetProjectionMatrix(),this._viewMatrixCached=this.forceGetViewMatrix()}get params(){return Object.assign({},this._params)}constructor(t){this.params=t}getViewMatrix(){return this._viewMatrixCached||(this._viewMatrixCached=SO.allocate()),this._viewMatrixCached}forceGetViewMatrix(){this._viewMatrixCached||(this._viewMatrixCached=SO.allocate());const{pos:t,center:e,up:i}=this.params.viewParams;return function(t,e,i,n){let s,r,a,o,l,h,c,d,u,p;const g=e[0],f=e[1],v=e[2],m=n[0],y=n[1],_=n[2],b=i[0],x=i[1],S=i[2];Math.abs(g-b)=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gD=[0,0,0],fD=new ee(1,0,0,1,0,0);let vD=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t}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({},zk),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Nk),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Vk),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0)}reset(){this.stack.length&&console.warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ee(1,0,0,1,0,0),this.stack.length=0,this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix.setValue(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f),this.nativeContext.setTransform(this.matrix.a,this.matrix.b,this.matrix.c,this.matrix.d,this.matrix.e,this.matrix.f))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.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&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&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,n,s,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,n,s,r,a,o)=>{if(o)for(;i>e;)i-=Tt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(m),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&gP.Set(e,i,n,r,a,g,u,p),g}(a,this.stops,t,e,h,i,n,o,l),r=!1),s}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,n){this.nativeContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){this.nativeContext.clearRect(t,e,i,n)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]);const n=this.camera.vp(t,e,i);t=n.x,e=n.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(cD(gD,[t,e,i],this.modelMatrix),t=gD[0],e=gD[1],i=gD[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,n){return this.nativeContext.getImageData(t,e,i,n)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oM.global.measureTextMethod;var i,n;return e&&"native"!==e?(this.mathTextMeasure||(this.mathTextMeasure=oM.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas))),this.mathTextMeasure.textSpec.fontFamily=null!==(i=this.fontFamily)&&void 0!==i?i:Vk.fontFamily,this.mathTextMeasure.textSpec.fontSize=null!==(n=this.fontSize)&&void 0!==n?n:Vk.fontSize,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={},this.mathTextMeasure.measure(t,e)):this.nativeContext.measureText(t)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?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,n){this.nativeContext.strokeRect(t,e,i,n)}strokeText(t,e,i,n){if(n=n||0,this.camera){this.modelMatrix&&(cD(gD,[e,i,n],this.modelMatrix),e=gD[0],i=gD[1],n=gD[2]);const t=this.camera.vp(e,i,n);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,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setCommonStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setCommonStyle(t,e,i,n,r)}return this._setCommonStyle(t,e,i,n,s)}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12?(r.globalAlpha=a*o,r.fillStyle=cI(this,l,t,i,n)):r.globalAlpha=a*o}setShadowStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowStyle(t,i[0]);const n={};return i.forEach((t=>{Object.assign(n,t)})),this._setShadowStyle(t,e,n)}return this._setShadowStyle(t,e,i)}_setShadowStyle(t,e,i){const n=this.nativeContext;i||(i=this.fillAttributes);const{opacity:s=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur}=e;s<=1e-12||(r||o||l?(n.shadowBlur=r,n.shadowColor=a,n.shadowOffsetX=o,n.shadowOffsetY=l,this._clearShadowStyle=!0):this._clearShadowStyle&&(n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h?(n.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(n.filter="blur(0px)",this._clearFilterStyle=!1))}setStrokeStyle(t,e,i,n,s){if(Array.isArray(s)){if(s.length<=1)return this._setStrokeStyle(t,e,i,n,s[0]);const r={};return s.forEach((t=>{Object.assign(r,t)})),this._setStrokeStyle(t,e,i,n,r)}return this._setStrokeStyle(t,e,i,n,s)}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}setTextStyleWithoutAlignBaseline(t,e,i){const n=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:s=e.scaleIn3d}=t;t.font?n.font=t.font:n.font=LP(t,e,s&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,n.textAlign="left",n.textBaseline="alphabetic"}setTextStyle(t,e,i){var n,s;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=LP(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!==(n=t.textAlign)&&void 0!==n?n:e.textAlign,r.textBaseline=null!==(s=t.textBaseline)&&void 0!==s?s:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(fD,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};vD.env="browser",vD=uD([fA(),pD("design:paramtypes",[Object,Number])],vD);var mD=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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={WIDTH:500,HEIGHT:500,DPR:1};let bD=class{get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){const{nativeCanvas:e,width:i=_D.WIDTH,height:n=_D.HEIGHT,dpr:s=_D.DPR,container:r,x:a,y:o,canvasControled:l=!0}=t;if(this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this.controled=l,"string"==typeof r){const t=oM.global.getElementById(r);t&&(this._container=t)}else this._container=r;this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new vD(this,this._dpr),this._id=e.id,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),null!=this.id&&(t.id=this.id.toString()),this._container&&this._container.appendChild(t),this.visiable||this.hide()}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:n=this._dpr,x:s=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*n,a.height=i*n,!a.style||this.setCanvasStyle(a,s,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,n,s){this.controled&&(t.style.padding="0",t.style.margin="0",t.style.border="0",t.style.background="transparent",t.style.width=`${n}px`,t.style.height=`${s}px`)}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}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)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}};bD.env="browser",bD=mD([fA(),yD("design:paramtypes",[Object])],bD);const xD=Symbol.for("CanvasArcPicker"),SD=Symbol.for("CanvasArc3dPicker"),wD=Symbol.for("CanvasAreaPicker"),AD=Symbol.for("CanvasCirclePicker"),kD=Symbol.for("CanvasImagePicker"),MD=Symbol.for("CanvasLinePicker"),CD=Symbol.for("CanvasPathPicker"),TD=Symbol.for("CanvasRectPicker"),ED=Symbol.for("CanvasRect3dPicker"),PD=Symbol.for("CanvasSymbolPicker"),RD=Symbol.for("CanvasTextPicker"),OD=Symbol.for("CanvasPolygonPicker"),BD=Symbol.for("CanvasPyramid3dPicker"),ID=Symbol.for("CanvasRichTextPicker"),DD=Symbol.for("CanvasGlyphPicker"),LD=Symbol.for("CanvasPickerContribution"),FD=Symbol.for("MathArcPicker"),jD=Symbol.for("MathAreaPicker"),zD=Symbol.for("MathCirclePicker"),HD=Symbol.for("MathLinePicker"),ND=Symbol.for("MathPathPicker"),VD=Symbol.for("MathRectPicker"),WD=Symbol.for("MathSymbolPicker"),GD=Symbol.for("MathTextPicker"),UD=Symbol.for("MathPolygonPicker"),YD=Symbol.for("MathGlyphPicker"),XD=Symbol.for("MathPickerContribution");var $D=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},KD=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qD=function(t,e){return function(i,n){e(i,n,t)}};let ZD=class extends nD{constructor(t,e,i,n,s,r,a,o,l,h,c,d,u,p,g){super(p,g),this.contributions=t,this.circlePicker=e,this.rectPicker=i,this.arcPicker=n,this.areaPicker=s,this.imagePicker=r,this.linePicker=a,this.pathPicker=o,this.symbolPicker=l,this.textPicker=h,this.polygonPicker=c,this.richtextPicker=d,this.drawContribution=u,this.global=p,this.pickItemInterceptorContributions=g,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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){const i={width:100,height:100,nativeCanvas:t.createCanvas({width:100,height:100}),id:"for-pick"};this.pickCanvas=new bD(i),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const tL=new ee(1,0,0,1,0,0),eL={x:0,y:0};let iL=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ee(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ee(1,0,0,1,0,0),this.path=new Dk}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return xO.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(xO.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,n,!1),this.scale(t,e,!1),this.translate(-i,-n,!1),s&&this.setTransformForCurrent()}setTransform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*n,o*s,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,n,s,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,n,s,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),n&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,n,s,r){this.path.arc(t,e,i,n,s,r)}arcTo(t,e,i,n,s){this.path.arcTo(t,e,i,n,s)}bezierCurveTo(t,e,i,n,s,r){this.path.bezierCurveTo(t,e,i,n,s,r)}closePath(){this.path.closePath()}ellipse(t,e,i,n,s,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,n){this.path.quadraticCurveTo(t,e,i,n)}rect(t,e,i,n){this.path.rect(t,e,i,n)}createImageData(t,e){return null}createLinearGradient(t,e,i,n){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,n,s,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,n){return null}fill(t,e){}fillRect(t,e,i,n){this.path.rect(t,e,i,n)}clearRect(t,e,i,n){}fillText(t,e,i){}getImageData(t,e,i,n){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},eL),function(t,e,i){return tC(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=hI(this,this.lineWidth,this.dpr);return function(t,e,i,n){return tC(t,e,!0,i,n)}(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,n){this.path.rect(t,e,i,n)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,n,s){}_setCommonStyle(t,e,i,n){}setStrokeStyle(t,e,i,n,s){}_setStrokeStyle(t,e,i,n){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(tL,t,e)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>xO.free(t))),this.stack.length=0}};iL=JD([fA(),QD("design:paramtypes",[Object,Number])],iL);var nL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rL=function(t,e){return function(i,n){e(i,n,t)}};let aL=class extends nD{constructor(t,e,i){super(e,i),this.contributions=t,this.global=e,this.pickItemInterceptorContributions=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}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new iL(null,1)}pickItem(t,e,i){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);return n&&n.contains(t,e,i)?t:null}};nL([SA(),sL("design:type",Function),sL("design:paramtypes",[]),sL("design:returntype",void 0)],aL.prototype,"init",null),aL=nL([fA(),rL(0,yA(wA)),rL(0,vA(XD)),rL(1,yA(EA)),rL(2,yA(wA)),rL(2,vA(ZI)),sL("design:paramtypes",[Object,Object,Object])],aL);var oL=new cA((t=>{t(ZD).toSelf().inSingletonScope(),t(aL).toSelf().inSingletonScope(),t(iD).toService(ZD),t(lD).toSelf().inSingletonScope(),t(oD).toService(lD),t(JI).toSelf().inSingletonScope(),t(ZI).toService(JI),kA(t,ZI)})),lL=new cA((t=>{t(PO).toSelf().inSingletonScope(),t(LE).toService(PO),t(oO).toSelf().inSingletonScope(),t(aO).toService(oO),kA(t,aO),t(cO).toSelf().inSingletonScope(),t(hO).toService(cO),kA(t,hO),t(pO).toSelf().inSingletonScope(),t(uO).toService(pO),kA(t,uO),t(vO).toSelf().inSingletonScope(),t(fO).toService(vO),kA(t,fO),t(_O).toSelf().inSingletonScope(),t(yO).toService(_O),kA(t,yO),t(FE).toConstantValue(XO)}));const hL=Symbol.for("AutoEnablePlugins"),cL=Symbol.for("PluginService");var dL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},uL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pL=function(t,e){return function(i,n){e(i,n,t)}};let gL=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&&SM.isBound(hL)&&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))}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};gL=dL([fA(),pL(0,yA(wA)),pL(0,vA(hL)),uL("design:paramtypes",[Object])],gL);var fL=new cA((t=>{t(gL).toSelf(),t(cL).toService(gL),kA(t,hL)})),vL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let mL=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}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"})))}};mL=vL([fA()],mL);var yL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_L=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};function bL(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let xL=class extends mL{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;if(e){const{clientX:n,clientY:s}=t,r=e.getBoundingClientRect(),a=null===(i=e.getNativeHandler)||void 0===i?void 0:i.call(e).nativeCanvas;let o,l;return a&&(o=r.width/a.offsetWidth,l=r.height/a.offsetHeight),{x:(n-r.left)/(_(o)?o:1),y:(s-r.top)/(_(l)?o:1)}}return{x:t.offsetX,y:t.offsetY}}loadImage(t){return bL(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return bL(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const n=document.createElement("canvas");t.id&&(n.id=null!==(e=t.id)&&void 0!==e?e:vC.GenAutoIncrementId().toString());const s=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.width=t.width*s,n.height=t.height*s),n}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(){}};function SL(){SM.rebind(iD).toService(aL)}xL=yL([fA(),_L("design:paramtypes",[])],xL);var wL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},AL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kL=class extends mL{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 this.freeCanvasList.length}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=tt.getSystemInfoSync().pixelRatio;e.forEach(((e,a)=>{const o=tt.createCanvasContext(e);o.canvas={width:t.width*r,height:t.height*r};const l={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>o,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,l),a>=n&&s.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};kL=wL([fA(),AL("design:paramtypes",[])],kL);var ML=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},CL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let TL=class extends mL{constructor(){super(),this.type="taro",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 this.freeCanvasList.length}configure(t,e){var i,n,s,r,a,o,l;t.env===this.type&&(t.setActiveEnvContribution(this),i=e.domref,n=e.canvasIdLists,s=this.canvasMap,r=e.freeCanvasIdx,a=this.freeCanvasList,o=e.taro,l=e.pixelRatio,n.forEach(((t,e)=>{const n=o.createCanvasContext(t);n.canvas={width:i.width*l,height:i.height*l},n.createRadialGradient||(n.createRadialGradient=function(){return n.createCircularGradient(...arguments)}),!n.getImageData&&o.canvasGetImageData&&(n.getImageData=(e,i,n,s)=>new Promise(((r,a)=>{try{o.canvasGetImageData({canvasId:t,x:e,y:i,width:n,height:s,success(t){r(t)}})}catch(t){a(t)}})));const h={id:t,width:i.width*l,height:i.height*l,offsetWidth:i.width,offsetHeight:i.height,getContext:()=>n,getBoundingClientRect:()=>({height:i.height,width:i.width})};return s.set(t,h),e>=r&&a.push(h),h})),this.taro=e.taro,this.pixelRatio=e.pixelRatio,SM.rebind(iD).toService(aL))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){const e=window||globalThis;if(e.DOMParser){const i=(new e.DOMParser).parseFromString(t,"image/svg+xml").children[0],n=(new XMLSerializer).serializeToString(i),s=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;return Promise.resolve({data:s,loadState:"success"})}if(e.Blob){const i=new e.Blob([t],{type:"image/svg+xml"}),n=e.URL.createObjectURL(i);return Promise.resolve({data:n,loadState:"success"})}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 this.pixelRatio}getRequestAnimationFrame(){return requestAnimationFrame}getCancelAnimationFrame(){return cancelAnimationFrame}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(){}};TL=ML([fA(),CL("design:paramtypes",[])],TL);var EL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RL=!1;try{RL=!!lynx.createCanvasNG}catch(t){}let OL=class extends mL{constructor(){super(),this.type="lynx",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){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,n,s){const r=SystemInfo.pixelRatio;e.forEach(((e,a)=>{const o=RL?lynx.createCanvasNG(e):lynx.createCanvas(e);o.width=t.width*r,o.height=t.height*r,RL&&o.attachToCanvasView(e);const l=o.getContext("2d");l.draw=(t,e)=>{e()};const h={width:t.width*r,height:t.height*r,offsetWidth:t.width,offsetHeight:t.height,id:null!=e?e:"",getContext:()=>l,getBoundingClientRect:()=>({height:t.height,width:t.width})};i.set(e,h),a>=n&&s.push(h)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList),SL())}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return this.freeCanvasList.length}loadImage(t){return function(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return Promise.reject();const e=lynx.createImage(t);return new Promise(((t,i)=>{e.onload=()=>{t(e)},e.onerror=()=>{i(new Error("加载失败"))}}))}(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}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 SystemInfo.pixelRatio}getRequestAnimationFrame(){return function(t){return oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.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(){}};OL=EL([fA(),PL("design:paramtypes",[])],OL);var BL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let IL=class extends mL{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 1}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};IL=BL([fA()],IL);var DL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FL=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let jL=class extends mL{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,n,s,r){return FL(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=n&&s.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.compoient).then((()=>{SL()}))}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 oT.call(t)}}getCancelAnimationFrame(){return t=>{oT.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return(null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.startsWith("mouse"))?t:null}};jL=DL([fA(),LL("design:paramtypes",[])],jL);var zL=new cA((t=>{t(xL).toSelf().inSingletonScope(),t(TA).toService(xL),t(kL).toSelf().inSingletonScope(),t(TA).toService(kL),t(TL).toSelf().inSingletonScope(),t(TA).toService(TL),t(OL).toSelf().inSingletonScope(),t(TA).toService(OL),t(jL).toSelf().inSingletonScope(),t(TA).toService(jL),t(IL).toSelf().inSingletonScope(),t(TA).toService(IL),kA(t,TA)})),HL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let VL=class{constructor(){this._uid=vC.GenAutoIncrementId()}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}};VL=HL([fA(),NL("design:paramtypes",[])],VL);var WL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},GL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},UL=function(t,e){return function(i,n){e(i,n,t)}};let YL=class extends VL{get container(){return this.canvas.nativeCanvas.parentElement}constructor(t){super(),this.global=t,this.type="browser"}getTitle(){return this.canvas.id.toString()}getWH(){return{width:this.canvas.width/(this.canvas.dpr||1),height:this.canvas.height/(this.canvas.dpr||1)}}getXY(){return this.canvas.nativeCanvas.getBoundingClientRect()}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}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 n={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new bD(n)}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 n=t.width,s=t.height;if(null==n||null==s||!t.canvasControled){const t=i.getBoundingClientRect();n=t.width,s=t.height}let r=t.dpr;!1===t.canvasControled&&(r&&console.warn("canvasControled为false后,dpr参数将无效"),r=null),null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/n),this.canvas=new bD({width:n,height:s,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(){return this.canvas.nativeCanvas.style}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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};YL.env="browser",YL=WL([fA(),UL(0,yA(EA)),GL("design:paramtypes",[Object])],YL);var XL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $L=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}getImageData(t,e,i,n){return new Promise(((s,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:n,success(t){s(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}createPattern(t,e){return null}};$L.env="feishu",$L=XL([fA()],$L);var KL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qL=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const ZL={WIDTH:500,HEIGHT:500,DPR:1};let JL=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=ZL.WIDTH,height:n=ZL.HEIGHT,dpr:s=ZL.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new $L(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};JL.env="feishu",JL=KL([fA(),qL("design:paramtypes",[Object])],JL);var QL=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eF=function(t,e){return function(i,n){e(i,n,t)}};let iF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new JL(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new JL({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};iF.env="feishu",iF=QL([fA(),eF(0,yA(EA)),tF("design:paramtypes",[Object])],iF);var nF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let sF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.setGlobalAlpha(t),this._globalAlpha=t}draw(){this.nativeContext.draw()}strokeText(t,e,i){}_setCommonStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.fillAttributes);const{fillOpacity:a=s.fillOpacity,opacity:o=s.opacity,fill:l=s.fill}=e;a>1e-12&&o>1e-12&&(r.setGlobalAlpha(a*o),r.setFillStyle(cI(this,l,t,i,n)))}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.setGlobalAlpha(a*o),r.setLineWidth(hI(this,l,this.dpr)),r.setStrokeStyle(cI(this,h,t,i,n)),r.setLineJoin(c),r.setLineDash(d),r.setLineCap(u),r.setMiterLimit(p)}}setTextStyleWithoutAlignBaseline(t,e){var i;const n=this.nativeContext;e||(e=this.textAttributes),t.font?n.font=t.font:n.font=LP(t,e),n.setFontSize(null!==(i=t.fontSize)&&void 0!==i?i:e.fontSize)}setTextStyle(t,e){var i,n;const s=this.nativeContext;e||(e=this.textAttributes),t.font?s.font=t.font:s.font=LP(t,e),s.setTextAlign(null!==(i=t.textAlign)&&void 0!==i?i:e.textAlign),s.setTextBaseline(null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline)}createConicGradient(t,e,i,n){return null}createPattern(t,e){return null}};sF.env="taro",sF=nF([fA()],sF);var rF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const oF={WIDTH:500,HEIGHT:500,DPR:1};let lF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=oF.WIDTH,height:n=oF.HEIGHT,dpr:s=oF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new sF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};lF.env="taro",lF=rF([fA(),aF("design:paramtypes",[Object])],lF);var hF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dF=function(t,e){return function(i,n){e(i,n,t)}};let uF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="taro",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new lF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new lF({width:i,height:n,dpr:s,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.length>0&&(t.changedTouches.forEach(((e,i)=>{t.changedTouches[i]=Object.assign(Object.assign({},t.changedTouches[i]),{offsetX:e.x,offsetY:e.y})})),t.offsetX=t.changedTouches[0].offsetX,t.offsetY=t.changedTouches[0].offsetY),t.touches.length>0&&t.touches.forEach(((e,i)=>{t.touches[i]=Object.assign(Object.assign({},t.touches[i]),{offsetX:e.x,offsetY:e.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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};uF.env="taro",uF=hF([fA(),dF(0,yA(EA)),cF("design:paramtypes",[Object])],uF);var pF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gF=class extends vD{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t,this._globalAlpha=t}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;i.setLineDash(t)}}_setStrokeStyle(t,e,i,n,s){const r=this.nativeContext;s||(s=this.strokeAttributes);const{strokeOpacity:a=s.strokeOpacity,opacity:o=s.opacity}=e;if(a>1e-12&&o>1e-12){const{lineWidth:l=s.lineWidth,stroke:h=s.stroke,lineJoin:c=s.lineJoin,lineDash:d=s.lineDash,lineCap:u=s.lineCap,miterLimit:p=s.miterLimit}=e;r.globalAlpha=a*o,r.lineWidth=hI(this,l,this.dpr),r.strokeStyle=cI(this,h,t,i,n),r.lineJoin=c,0===d[0]&&0===d[1]||r.setLineDash(d),r.lineCap=u,r.miterLimit=p}}createPattern(t,e){return null}draw(){const t=this.nativeContext;this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))}))}};gF.env="lynx",gF=pF([fA()],gF);var fF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mF={WIDTH:500,HEIGHT:500,DPR:1};let yF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=mF.WIDTH,height:n=mF.HEIGHT,dpr:s=mF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new gF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};yF.env="lynx",yF=fF([fA(),vF("design:paramtypes",[Object])],yF);var _F=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xF=function(t,e){return function(i,n){e(i,n,t)}};let SF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="lynx",this.eventManager=new class{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={}}}}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new yF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new yF({width:i,height:n,dpr:s,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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};SF.env="lynx",SF=_F([fA(),xF(0,yA(EA)),bF("design:paramtypes",[Object])],SF);var wF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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 kF=class extends vD{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 ee(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};kF.env="node",kF=wF([fA(),AF("design:paramtypes",[Object,Number])],kF);var MF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const TF={WIDTH:500,HEIGHT:500,DPR:1};let EF=class{get id(){return this._id}get x(){return 0}set x(t){}get y(){return 0}set y(t){}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get displayWidth(){return this._pixelWidth/this._dpr}get displayHeight(){return this._pixelHeight/this._dpr}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.width,this.height)}constructor(t){const{nativeCanvas:e,width:i=TF.WIDTH,height:n=TF.HEIGHT,canvasControled:s=!0,dpr:r=TF.DPR}=t;this._visiable=!1!==t.visiable,this.controled=s,this._pixelWidth=i*r,this._pixelHeight=n*r,this._displayWidth=i,this._displayHeight=n,this._nativeCanvas=e,this._context=new kF(this,t.dpr),this._id=e.id,this._dpr=r}applyPosition(){}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}hide(){}show(){}resize(t,e){this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas&&(this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight)}toDataURL(t,e){return""}readPixels(t,e,i,n){return this._context.getImageData(t,e,i,n)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this._nativeCanvas.release&&o(this._nativeCanvas.release)&&this._nativeCanvas.release()}};EF.env="node",EF=MF([fA(),CF("design:paramtypes",[Object])],EF);var PF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},OF=function(t,e){return function(i,n){e(i,n,t)}};let BF=class extends VL{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:vC.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new EF(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,n=t.height;null!=i&&null!=n&&t.canvasControled||(i=e.width,n=e.height),this.canvas=new EF({width:i,height:n,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t,e){}};BF.env="node",BF=PF([fA(),OF(0,yA(EA)),RF("design:paramtypes",[Object])],BF);var IF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let DF=class extends vD{draw(){}createPattern(t,e){return null}};DF.env="wx",DF=IF([fA()],DF);var LF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)};const jF={WIDTH:500,HEIGHT:500,DPR:1};let zF=class{get id(){return this._id}get x(){return this._x}set x(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}get displayWidth(){return this._displayWidth}get displayHeight(){return this._displayHeight}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}constructor(t){const{nativeCanvas:e,width:i=jF.WIDTH,height:n=jF.HEIGHT,dpr:s=jF.DPR}=t,{x:r,y:a}=e.getBoundingClientRect?e.getBoundingClientRect():{x:0,y:0};this._x=r,this._y=a,this._pixelWidth=i*s,this._pixelHeight=n*s,this._visiable=!1!==t.visiable,this._displayWidth=i,this._displayHeight=n,this._dpr=s,this._nativeCanvas=e,this._context=new DF(this,this._dpr),this._id=e.id}getNativeCanvas(){return this._nativeCanvas}resetStyle(t){}applyPosition(){}hide(){}show(){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,n){throw new Error("暂未实现")}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){}};zF.env="wx",zF=LF([fA(),FF("design:paramtypes",[Object])],zF);var HF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},NF=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},VF=function(t,e){return function(i,n){e(i,n,t)}};class WF{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 GF=class extends VL{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new WF}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:vC.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new zF(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,n=t.height;if(null==i||null==n||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,n=t.height}let s=t.dpr;null==s&&(s=e.width/i),this.canvas=new zF({width:i,height:n,dpr:s,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,n,s;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!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s: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,e){const i=this.getContext(),n=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(n,0,0,n,0,0),i.clearRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1),e&&(i.fillStyle=e,i.fillRect(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1)),i.nativeContext.restore()}};GF.env="wx",GF=HF([fA(),VF(0,yA(EA)),NF("design:paramtypes",[Object])],GF);var UF=new cA((t=>{t(YL).toSelf(),t(qE).toDynamicValue((t=>t.container.get(YL))).whenTargetNamed(YL.env),t(iF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(iF))).whenTargetNamed(iF.env),t(uF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(uF))).whenTargetNamed(uF.env),t(SF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(SF))).whenTargetNamed(SF.env),t(GF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(GF))).whenTargetNamed(GF.env),t(BF).toSelf(),t(qE).toDynamicValue((t=>t.container.get(BF))).whenTargetNamed(BF.env)})),YF=new cA((t=>{t(xM).toSelf().inSingletonScope(),t(bM).toService(xM),kA(t,bM)})),XF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},KF=function(t,e){return function(i,n){e(i,n,t)}};let qF=class{constructor(t){this.global=t,this.offscreen=!1}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,t=i.canvasId?this.global.getElementById(i.canvasId):this.global.createCanvas({width:e.width,height:e.height}),t.style&&(t.style["pointer-events"]="none");const n=e.getContext().getCanvas().nativeCanvas,s=kM({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,canvasControled:!0,container:e.getContainer(),x:n.offsetLeft,y:n.offsetTop});s.applyPosition(),this.canvas=s,this.context=s.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var n;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!==(n=e.background)&&void 0!==n?n:"#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 n;const s=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:s},i),{clear:i.clear?null!==(n=i.background)&&void 0!==n?n:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};qF=XF([fA(),KF(0,yA(EA)),$F("design:paramtypes",[Object])],qF);var ZF=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let tj=class{constructor(t){this.global=t,this.offscreen=!0}setDpr(t){this.canvas.dpr=t}init(t,e,i){this.layer=t;const n=kM({nativeCanvas:this.global.createOffscreenCanvas({width:i.width,height:i.height,dpr:e.dpr}),width:i.width,height:i.height,dpr:e.dpr,canvasControled:!0});this.canvas=n,this.context=n.getContext()}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){this.canvas.resize(t,e)}render(t,e){var i;e.renderService.render(t,Object.assign(Object.assign({context:this.context},e),{x:0,y:0,clear:null!==(i=e.background)&&void 0!==i?i:"#ffffff"}))}prepare(t,e){}release(){this.canvas.release()}getContext(){return this.context}drawTo(t,e,i){const n=t.getContext(),s=t.dpr,{x:r=0,y:a=0,width:o=this.layer.viewWidth,height:l=this.layer.viewHeight}=i;n.nativeContext.save(),n.nativeContext.setTransform(s,0,0,s,0,0),i.clear&&n.clearRect(r,a,o,l),n.drawImage(this.canvas.nativeCanvas,0,0,this.canvas.width,this.canvas.height,r,a,o,l),n.nativeContext.restore()}merge(t){}};tj=ZF([fA(),QF(0,yA(EA)),JF("design:paramtypes",[Object])],tj);var ej=new cA((t=>{t(qF).toSelf(),t(tj).toSelf(),t(HE).toService(qF)}));var ij=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const nj=Symbol.for("DrawItemInterceptor"),sj=new $t;let rj=class{constructor(){this.order=1}afterDrawItem(t,e,i,n,s){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),n.dirtyBounds&&n.backupDirtyBounds){sj.copy(n.dirtyBounds);const e=t.globalTransMatrix.getInverse();n.dirtyBounds.copy(n.backupDirtyBounds).transformWithMatrix(e)}return n.renderGroup(t.shadowRoot,i),r.highPerformanceRestore(),n.dirtyBounds&&n.backupDirtyBounds&&n.dirtyBounds.copy(sj),!0}};rj=ij([fA()],rj);let aj=class{constructor(){this.order=1}beforeDrawItem(t,e,i,n,s){if(!t.in3dMode||i.in3dInterceptor)return!1;i.in3dInterceptor=!0;const{context:r,stage:a}=e.drawParams;r.canvas,r.save(),this.initCanvasCtx(r),r.camera=a.camera;const o=r.currentMatrix;o.a/=r.dpr,o.b/=r.dpr,o.c/=r.dpr,o.d/=r.dpr,o.e/=r.dpr,o.f/=r.dpr;const l=SO.allocate();CO(l,o);const h=r.modelMatrix;if(h){if(l){const t=SO.allocate();r.modelMatrix=TO(t,h,l)}}else r.modelMatrix=l;if(r.setTransform(1,0,0,1,0,0,!0),t.isContainer){let e=!1,s=!1;if(t.forEachChildren((t=>(e=t.numberType===xE,!e))),t.forEachChildren((t=>(s=!!t.findFace,!s))),e){const e=t.getChildren(),s=[...e];s.sort(((t,e)=>{var i,n,s,r;let a=((null!==(i=t.attribute.startAngle)&&void 0!==i?i:0)+(null!==(n=t.attribute.endAngle)&&void 0!==n?n:0))/2,o=((null!==(s=e.attribute.startAngle)&&void 0!==s?s:0)+(null!==(r=e.attribute.endAngle)&&void 0!==r?r:0))/2;for(;a<0;)a+=Tt;for(;o<0;)o+=Tt;return o-a})),s.forEach((t=>{t._next=null,t._prev=null})),t.removeAllChild(),t.update(),s.forEach((e=>{t.appendChild(e)})),i.hack_pieFace="outside",n.renderGroup(t,i),i.hack_pieFace="inside",n.renderGroup(t,i),i.hack_pieFace="top",n.renderGroup(t,i),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),e.forEach((e=>{t.appendChild(e)}))}else if(s){const e=t.getChildren(),s=e.map((t=>({ave_z:t.findFace().vertices.map((e=>{var i;return r.view(e[0],e[1],null!==(i=e[2]+t.attribute.z)&&void 0!==i?i:0)[2]})).reduce(((t,e)=>t+e),0),g:t})));s.sort(((t,e)=>e.ave_z-t.ave_z)),t.removeAllChild(),s.forEach((t=>{t.g._next=null,t.g._prev=null})),t.update(),s.forEach((e=>{t.add(e.g)})),n.renderGroup(t,i,!0),t.removeAllChild(),e.forEach((t=>{t._next=null,t._prev=null})),t.update(),e.forEach((e=>{t.add(e)}))}else n.renderGroup(t,i)}else n.renderItem(t,i);return r.camera=null,r.restore(),r.modelMatrix!==h&&SO.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}};aj=ij([fA()],aj);var oj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hj=function(t,e){return function(i,n){e(i,n,t)}};let cj=class{constructor(t,e,i,n){this.contributions=t,this.renderSelector=e,this.layerService=i,this.drawItemInterceptorContributions=n,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Xt,this.backupDirtyBounds=new Xt}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))}draw(t,e){e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:n,x:s=0,y:r=0,width:a,height:o}=e;if(!i)return;const l=this.dirtyBounds.setValue(0,0,a,o);if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=Ce(l,n.dirtyBounds,!1);l.x1=Math.floor(t.x1),l.y1=Math.floor(t.y1),l.x2=Math.ceil(t.x2),l.y2=Math.ceil(t.y2)}this.backupDirtyBounds.copy(l),i.inuse=!0,i.clearMatrix(),i.setTransformForCurrent(!0);const h=l.width()*i.dpr!==i.canvas.width||l.height()*i.dpr!==i.canvas.height;i.save(),i.translate(s,r,!0),h&&(i.beginPath(),i.rect(l.x1,l.y1,l.width(),l.height()),i.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,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),i.restore(),i.restore(),i.draw(),i.inuse=!1}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=KI(e,i,Uk.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i){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(!Ee(t.AABBBounds,this.dirtyBounds,!1))return;const n=this.dirtyBounds.clone(),s=t.globalTransMatrix.getInverse();this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(s),this.renderItem(t,e,{drawingCb:()=>{var n;i?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))})):XI(t,Uk.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e):this.renderItem(t,e))}),!1,!!(null===(n=e.context)||void 0===n?void 0:n.camera))}}),this.dirtyBounds.copy(n)}_increaseRender(t,e){const{layer:i,stage:n}=e,{subLayers:s}=i;let r=s.get(t._uid);r||(r={layer:this.layerService.createLayer(n),zIndex:s.size,group:t},s.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||SM.get(WB);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=s.get(l._uid);t||(t={layer:this.layerService.createLayer(n),zIndex:s.size},s.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=this.renderSelector.selector(t);return e||(e=this.selectRenderByNumberType(t.numberType)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let uj=class{selector(t){return null}};uj=dj([fA()],uj);var pj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fj=function(t,e){return function(i,n){e(i,n,t)}};let vj=class{constructor(t){this.groupRenderContribitions=t,this.numberType=kE}drawShape(t,e,i,n,s,r,a,o){const l=fC(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:v=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:y=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible}=t.attribute,w=rP(u,m,p,g,h),A=oP(u,y,p,g),k=iP(h,c),M=nP(d,x);if(!t.valid||!S)return;if(!v){if(!k&&!M)return;if(!(w||A||a||o||c))return}if(b&&b.length&&s.drawContribution){const t=e.disableFill,i=e.disableStroke,n=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{s.drawContribution.getRenderContribution(t).draw(t,s.renderService,s,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=n}else 0===_||f(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,n,p,g)):(e.beginPath(),vB(e,i,n,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[]);const C={doFill:k,doStroke:M};this._groupRenderContribitions.forEach((r=>{r.time===tk.beforeFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o,C)})),v&&e.clip(),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,l),C.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,i,n,l),e.fill())),C.doStroke&&(o?o(e,t.attribute,l):A&&(e.setStrokeStyle(t,t.attribute,i,n,l),e.stroke())),this._groupRenderContribitions.forEach((r=>{r.time===tk.afterFillStroke&&r.drawShape(t,e,i,n,k,M,w,A,l,s,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;const{clip:r}=t.attribute;r?s.save():s.highPerformanceSave();const a=fC(t,null==n?void 0:n.theme).group,o=s.modelMatrix;if(s.camera){const e=SO.allocate(),i=SO.allocate();EO(i,t,a),TO(e,o||e,i),s.modelMatrix=e,SO.free(i),s.setTransform(1,0,0,1,0,0,!0)}else s.transformFromMatrix(t.transMatrix,!0);s.beginPath(),n.skipDraw?this.drawShape(t,s,0,0,i,n,(()=>!1),(()=>!1)):this.drawShape(t,s,0,0,i);const{scrollX:l=a.scrollX,scrollY:h=a.scrollY}=t.attribute;let c;(l||h)&&s.translate(l,h),n&&n.drawingCb&&(c=n.drawingCb()),s.modelMatrix!==o&&SO.free(s.modelMatrix),s.modelMatrix=o,c&&c.then?c.then((()=>{r?s.restore():s.highPerformanceRestore()})):r?s.restore():s.highPerformanceRestore()}};vj=pj([fA(),fj(0,yA(wA)),fj(0,vA(yP)),gj("design:paramtypes",[Object])],vj);var mj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let yj=class extends iB{constructor(){super(...arguments),this.numberType=CE}drawShape(t,e,i,n,s,r,a,o){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:e,length:r}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=fC(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:v=h.visible}=t.attribute,m=sP(u,p,c),y=aP(u,g),_=iP(c),b=nP(d,f);if(!t.valid||!v)return;if(!_&&!b)return;if(!(m||y||a||o))return;const{context:x}=s;for(let s=e;s{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}))}(e.nativeContext,i,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setStrokeStyle(t,s,a,o,r),e.stroke())}};yj=mj([fA()],yj);var _j=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let bj=class extends cB{constructor(){super(...arguments),this.numberType=SE}drawShape(t,e,i,n,s,r,a){if(t.incremental&&s.multiGraphicOptions){const{startAtIdx:r,length:o}=s.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=fC(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=sP(u,d,c),f=iP(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let s=r;s{var a,o,l,h;const c=e&&0===n?e.points[e.points.length-1]:i[0];t.moveTo(c.x+s,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+s,e.y+r):t.moveTo(e.x+s,e.y+r)}));for(let e=i.length-1;e>=0;e--){const n=i[e];t.lineTo(null!==(a=n.x1)&&void 0!==a?a:n.x,null!==(o=n.y1)&&void 0!==o?o:n.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,n,{offsetX:a,offsetY:o}),e.setShadowStyle&&e.setShadowStyle(t,s,r),e.setCommonStyle(t,s,a,o,r),e.fill())}};bj=_j([fA()],bj);var xj,Sj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Aj=function(t,e){return function(i,n){e(i,n,t)}},kj=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(xj||(xj={}));let Mj=class extends cj{constructor(t,e,i,n,s,r){super(t,e,s,r),this.contributions=t,this.renderSelector=e,this.lineRender=i,this.areaRender=n,this.layerService=s,this.drawItemInterceptorContributions=r,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=xj.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new CA([])}}init(){super.init(),this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return kj(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:n,x:s=0,y:r=0}=e;n&&(n.inuse=!0,n.clearMatrix(),n.setTransformForCurrent(!0),n.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,n,e),n.translate(s,r,!0),n.save(),t.renderTreeRoots.sort(((t,e)=>{var i,n;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Uk.zIndex)-(null!==(n=e.attribute.zIndex)&&void 0!==n?n:Uk.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{n.restore(),n.restore(),n.draw(),n.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return kj(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return kj(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>kj(this,void 0,void 0,(function*(){if(2!==t.count)yield $I(t,Uk.zIndex,((i,n)=>{if(this.status===xj.STOP)return!0;if(i.isContainer)return!1;if(n{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return kj(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return kj(this,void 0,void 0,(function*(){this.rendering&&(this.status=xj.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=xj.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 kj(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:()=>kj(this,void 0,void 0,(function*(){yield $I(t,Uk.zIndex,(t=>kj(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Sj([yA(EA),wj("design:type",Object)],Mj.prototype,"global",void 0),Mj=Sj([fA(),Aj(0,_A($B)),Aj(1,yA(oI)),Aj(2,yA(yj)),Aj(3,yA(bj)),Aj(4,yA(tP)),Aj(5,yA(wA)),Aj(5,vA(nj)),wj("design:paramtypes",[Array,Object,Object,Object,Object,Object])],Mj);var Cj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Tj=class extends JO{constructor(){super(...arguments),this.type="rect3d",this.numberType=OE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).rect3d,{fill:c=h.fill,stroke:d=h.stroke,width:u=h.width,height:p=h.height,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:v=h.lineWidth,strokeOpacity:m=h.strokeOpacity,visible:y=h.visible}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=rP(g,f,u,p,c),x=oP(g,m,u,p),S=iP(c),w=nP(d,v);if(!t.valid||!y)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,s,e,A,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o={x:t+a[0],y:e+a[1],z:i+a[2]},l=r[n[1]],h={x:t+l[0],y:e+l[1],z:i+l[2]};s.beginPath(),s.moveTo(o.x,o.y,o.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o){const l=FT.get(s).value,h=n.vertices,c=h.map((t=>r.view(t[0],t[1],t[2])[2])),d=[];n.polygons.forEach(((t,e)=>{d.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,s=c[i[0]],r=c[i[1]],a=c[i[2]],o=c[i[3]];t.ave_z=s+r+a+o})),d.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),d.forEach((n=>{const{polygon:c,normal:d}=n.polygon,u=h[c[0]],p=h[c[1]],g=h[c[2]],f=h[c[3]],v={x:t+u[0],y:e+u[1],z:i+u[2]},m={x:t+p[0],y:e+p[1],z:i+p[2]},y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]};r.beginPath(),r.moveTo(v.x,v.y,v.z),r.lineTo(m.x,m.y,m.z),r.lineTo(y.x,y.y,y.z),r.lineTo(_.x,_.y,_.z),r.closePath(),o?o(r,null,null):(r.fillStyle=a?a.computeColor(d,l):s,r.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).rect,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Tj=Cj([fA()],Tj);var Ej=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pj=class{constructor(){this.numberType=BE}drawShape(t,e,i,n,s){const r=fC(t).richtext,{width:a=r.width,height:o=r.height,opacity:l=r.opacity,fillOpacity:h=r.fillOpacity,visible:c=r.visible}=t.attribute;t.valid&&c&&sP(l,h,!0)&&(e.translate(i,n),t.getFrameCache().draw(e,this.drawIcon))}drawIcon(t,e,i,n,s){var r;const a=fC(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:v}=t.attribute,{backgroundWidth:m=o,backgroundHeight:y=l}=t.attribute;if(v&&(i+=t._marginArray[3],n+=t._marginArray[0]),t._hovered){const t=(m-o)/2,s=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,n-s,m,y)):(e.beginPath(),vB(e,i-t,n-s,m,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,n,o,l))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).richtext;let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);this.drawShape(t,n,r,a,i),n.highPerformanceRestore()}};Pj=Ej([fA()],Pj);var Rj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Oj=class{constructor(){this.numberType=AE}drawShape(t,e,i,n,s,r,a,o){s.drawContribution&&t.getSubGraphic().forEach((t=>{const l=s.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,n,s,r,a,o)}))}draw(t,e,i,n){const{context:s}=i;if(!s)return;if(s.highPerformanceSave(),!i.drawContribution)return;const r=fC(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),s.highPerformanceRestore()}};Oj=Rj([fA()],Oj);var Bj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ij=class extends JO{constructor(){super(...arguments),this.numberType=xE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).arc,{fill:c=h.fill,background:d,stroke:u=h.stroke,opacity:p=h.opacity,fillOpacity:g=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:m=h.visible}=t.attribute,y=sP(p,g,c),_=aP(p,v),b=iP(c,d),x=nP(u,f),S=null!==(l=this.z)&&void 0!==l?l:0;if(!t.valid||!m)return;if(!b&&!x)return;if(!(y||_||a||o||d))return;const{outerRadius:w=h.outerRadius,innerRadius:A=h.innerRadius,height:k=10}=t.attribute,M=FT.get(c).value,{light:C}=s.stage||{},T=s.hack_pieFace,E={top:S,bottom:S+k},P={top:[0,1,0],bottom:[0,-1,0],outside:[1,0,-1],inside:[1,0,-1]};"bottom"===T||"top"===T?(e.beginPath(),function(t,e,i,n,s,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Et(l-o),c=l>o;let d=!1;if(r=Tt-At)e.moveTo(i+r*Rt(o),n+r*It(o),s),e.arc(i,n,r,o,l,!c,s),a>At&&(e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,o,c,s));else{const{outerDeltaAngle:h,innerDeltaAngle:u,outerStartAngle:p,outerEndAngle:g,innerEndAngle:f,innerStartAngle:v}=t.getParsePadAngle(o,l),m=r*Rt(p),y=r*It(p),_=a*Rt(f),b=a*It(f);h<.001?d=!0:(e.moveTo(i+m,n+y,s),e.arc(i,n,r,p,g,!c,s)),!(a>At)||u<.001?(e.lineTo(i+_,n+b,s),d=!0):(e.lineTo(i+_,n+b,s),e.arc(i,n,a,f,v,c,s))}e.closePath()}(t,e,i,n,E[T],w,A),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke()))):"outside"!==T&&"inside"!==T||("inside"===T&&(e.save(),e.beginPath(),e.arc(i,n,A,0,Tt,!0,E.top),e.clip()),e.beginPath(),function(t,e,i,n,s,r,a,o){const{startAngle:l,endAngle:h}=t.getParsedAngle(),c=Et(h-l),d=h>l;let u=!1;if(a<=At)e.moveTo(i,n,s);else if(c>=Tt-At)e.moveTo(i+a*Rt(l),n+a*It(l),s),e.arc(i,n,a,l,h,!d,s),e.lineTo(i+a*Rt(h),n+a*It(h),r),e.arc(i,n,a,h,l,d,r);else{const{innerouterDeltaAngle:t,innerouterStartAngle:c,innerouterEndAngle:p}=o(l,h),g=a*Rt(c),f=a*It(c),v=a*Rt(p),m=a*It(p);t<.001?u=!0:(e.moveTo(i+g,n+f,s),e.arc(i,n,a,c,p,!d,s),e.lineTo(i+v,n+m,r),e.arc(i,n,a,p,c,d,r))}e.closePath()}(t,e,i,n,E.top,E.bottom,"outside"===T?w:A,((e,i)=>{const{outerDeltaAngle:n,innerDeltaAngle:s,outerStartAngle:r,outerEndAngle:a,innerEndAngle:o,innerStartAngle:l}=t.getParsePadAngle(e,i);return"outside"===T?{innerouterDeltaAngle:n,innerouterEndAngle:a,innerouterStartAngle:r}:{innerouterDeltaAngle:s,innerouterEndAngle:o,innerouterStartAngle:l}})),e.setShadowStyle&&e.setShadowStyle(t,t.attribute,h),b&&(a?a(e,t.attribute,h):y&&(e.setCommonStyle(t,t.attribute,i,n,h),e.fillStyle=C?C.computeColor(P[T],M):c,e.fill())),x&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,i,n,h),e.stroke())),"inside"===T&&e.restore())}draw(t,e,i,n){const{context:s}=i;if(!s)return;const r=fC(t,null==n?void 0:n.theme).arc;s.save();const a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;this.z=h,lP(t,s,o,l,0,n)||(this.drawShape(t,s,o,l,i,n),this.z=0,s.modelMatrix!==c&&SO.free(s.modelMatrix),s.modelMatrix=c),s.restore()}};Ij=Bj([fA()],Ij);var Dj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lj=class extends JO{constructor(){super(...arguments),this.type="pyramid3d",this.numberType=PE}drawShape(t,e,i,n,s,r,a,o){var l;const h=fC(t,null==r?void 0:r.theme).polygon,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,lineWidth:g=h.lineWidth,strokeOpacity:f=h.strokeOpacity,visible:v=h.visible,points:m,face:y=[!0,!0,!0,!0,!0,!0]}=t.attribute,_=null!==(l=this.z)&&void 0!==l?l:0,b=sP(u,p,c),x=aP(u,f),S=iP(c),w=nP(d,g);if(!t.valid||!v||4!==m.length)return;if(!S&&!w)return;if(!(b||x||a||o))return;const{light:A,camera:k}=s.stage||{},M=t.findFace();if(!1!==c){e.setCommonStyle(t,t.attribute,i,n,h);let s=c;"string"!=typeof s&&(s="black"),this.fill(i,n,_,M,y,s,e,A,k,t,h,a)}!1!==d&&(e.setStrokeStyle(t,t.attribute,i,n,h),this.stroke(i,n,_,M,e))}stroke(t,e,i,n,s){const r=n.vertices;n.edges.forEach((n=>{const a=r[n[0]],o=r[n[1]],l={x:t+a[0],y:e+a[1],z:i+a[2]},h={x:t+o[0],y:e+o[1],z:i+o[2]};s.beginPath(),s.moveTo(l.x,l.y,l.z),s.lineTo(h.x,h.y,h.z),s.stroke()}))}fill(t,e,i,n,s,r,a,o,l,h,c,d){const u=FT.get(r).value,p=n.vertices,g=p.map((t=>a.view(t[0],t[1],t[2])[2])),f=[];n.polygons.forEach(((t,e)=>{if(!s[e])return;f.push({faceIdx:e,polygon:t});const{polygon:i,normal:n}=t,r=g[i[0]],a=g[i[1]],o=g[i[2]],l=g[i[3]];t.ave_z=r+a+o+l})),f.sort(((t,e)=>e.polygon.ave_z-t.polygon.ave_z)),f.forEach((n=>{const{polygon:s,normal:l}=n.polygon,g=p[s[0]],f=p[s[1]],v=p[s[2]],m=p[s[3]],y={x:t+g[0],y:e+g[1],z:i+g[2]},_={x:t+f[0],y:e+f[1],z:i+f[2]},b={x:t+v[0],y:e+v[1],z:i+v[2]},x={x:t+m[0],y:e+m[1],z:i+m[2]};a.beginPath(),a.moveTo(y.x,y.y,y.z),a.lineTo(_.x,_.y,_.z),a.lineTo(b.x,b.y,b.z),a.lineTo(x.x,x.y,x.z),a.closePath(),d?d(a,h.attribute,c):(a.fillStyle=o?o.computeColor(l,u):r,a.fill())}))}draw(t,e,i){const{context:n}=i;if(!n)return;n.highPerformanceSave();const s=fC(t).polygon,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;this.z=l,this.drawShape(t,n,a,o,i),this.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore()}};Lj=Dj([fA()],Lj);var Fj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let jj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};jj=Fj([fA()],jj);let zj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};zj=Fj([fA()],zj);var Hj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Nj=Hj([fA()],Nj);let Vj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}};Vj=Hj([fA()],Vj);var Wj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gj=class extends fI{constructor(){super(...arguments),this.time=tk.beforeFillStroke}};Gj=Wj([fA()],Gj);let Uj=class extends mI{constructor(){super(...arguments),this.time=tk.afterFillStroke}drawShape(t,e,i,n,s,r,a,o,l,h,c,d,u){var p,g,f,v;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:m=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:rT(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:rT(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:rT(l,"textureSize")),texturePadding:x=(null!==(v=t.attribute.texturePadding)&&void 0!==v?v:rT(l,"texturePadding"))}=m;if(!y)return;let S=this.textureMap.get(y);if(!S)switch(y){case"circle":S=this.createCirclePattern(b,x,_,e);break;case"diamond":S=this.createDiamondPattern(b,x,_,e);break;case"rect":S=this.createRectPattern(b,x,_,e);break;case"vertical-line":S=this.createVerticalLinePattern(b,x,_,e);break;case"horizontal-line":S=this.createHorizontalLinePattern(b,x,_,e);break;case"bias-lr":S=this.createBiasLRLinePattern(b,x,_,e);break;case"bias-rl":S=this.createBiasRLLinePattern(b,x,_,e);break;case"grid":S=this.createGridPattern(b,x,_,e)}S&&(e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,n,l),e.fillStyle=S,e.fill(),e.highPerformanceRestore())}};Uj=Wj([fA()],Uj);var Yj=new cA((t=>{t(cj).toSelf(),t(lI).toService(cj),t(Mj).toSelf(),t(WB).toService(Mj),t(uj).toSelf(),t(oI).toService(uj),t(BP).toSelf().inSingletonScope(),t(XB).to(BP),t($B).to(BP),t(wI).toSelf().inSingletonScope(),t(AI).toSelf().inSingletonScope(),t(kI).toSelf().inSingletonScope(),t(mP).toService(wI),t(mP).toService(AI),t(mP).toService(kI),kA(t,mP),t(bB).toSelf().inSingletonScope(),t(QB).to(bB),t($B).to(bB),t(Tj).toSelf().inSingletonScope(),t(tI).toService(Tj),t($B).toService(tI),t(RI).toSelf().inSingletonScope(),t(OI).toSelf().inSingletonScope(),t(BI).toSelf().inSingletonScope(),t(II).toSelf().inSingletonScope(),t(DI).toSelf().inSingletonScope(),t(SP).toService(RI),t(SP).toService(OI),t(SP).toService(BI),t(SP).toService(II),t(SP).toService(DI),kA(t,SP),t(TB).toSelf().inSingletonScope(),t(iI).to(TB),t($B).to(TB),kA(t,AP),t(gB).toSelf().inSingletonScope(),t(ZB).to(gB),t($B).to(gB),t(Nj).toSelf().inSingletonScope(),t(Vj).toSelf().inSingletonScope(),t(bP).toService(Nj),t(bP).toService(Vj),kA(t,bP),t(AB).toSelf().inSingletonScope(),t(eI).to(AB),t($B).to(AB),t(FI).toSelf().inSingletonScope(),t(jI).toSelf().inSingletonScope(),t(zI).toSelf().inSingletonScope(),t(wP).toService(FI),t(wP).toService(jI),t(wP).toService(zI),kA(t,wP),t(EP).toSelf().inSingletonScope(),t(GB).to(EP),t($B).to(EP),t(Ij).toSelf().inSingletonScope(),t(UB).toService(Ij),t($B).toService(UB),t(_I).toSelf().inSingletonScope(),t(bI).toSelf().inSingletonScope(),t(xI).toSelf().inSingletonScope(),t(fP).toService(_I),t(fP).toService(bI),t(fP).toService(xI),kA(t,fP),t(iB).toSelf().inSingletonScope(),t(qB).to(iB),t($B).to(iB),t(yj).toSelf().inSingletonScope(),t(bj).toSelf().inSingletonScope(),t(cB).toSelf().inSingletonScope(),t(YB).to(cB),t($B).to(cB),t(Gj).toSelf().inSingletonScope(),t(Uj).toSelf().inSingletonScope(),t(vP).toService(Gj),t(vP).toService(Uj),kA(t,vP),t(vj).toSelf().inSingletonScope(),t(KB).to(vj),t($B).to(vj),t(CI).toSelf().inSingletonScope(),t(yP).toService(CI),kA(t,yP),t(FB).toSelf().inSingletonScope(),t(JB).to(FB),t($B).to(FB),t(jj).toSelf().inSingletonScope(),t(zj).toSelf().inSingletonScope(),t(xP).toService(jj),t(xP).toService(zj),kA(t,xP),t(Oj).toSelf().inSingletonScope(),t(rI).toService(Oj),t($B).toService(rI),t(VB).toSelf().inSingletonScope(),t(aI).toService(VB),t($B).toService(aI),t(EI).toSelf().inSingletonScope(),t(_P).toService(EI),kA(t,_P),t(Pj).toSelf().inSingletonScope(),t(nI).toService(Pj),t($B).toService(nI),t(Lj).toSelf().inSingletonScope(),t(sI).toService(Lj),t($B).toService(sI),t(vI).toSelf().inSingletonScope(),t(AP).toService(vI),t(fP).toService(vI),t(bP).toService(vI),t(wP).toService(vI),t(SP).toService(vI),t(_P).toService(vI),t(mP).toService(vI),t(vP).toService(vI),t(xP).toService(vI),kA(t,kP),kA(t,$B),t(rj).toSelf().inSingletonScope(),t(nj).toService(rj),t(aj).toSelf().inSingletonScope(),t(nj).toService(aj),kA(t,nj)}));var Xj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},Kj=function(t,e){return function(i,n){e(i,n,t)}};let qj=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};qj=Xj([fA(),Kj(0,yA(XB)),$j("design:paramtypes",[Object])],qj);var Zj=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jj=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qj=function(t,e){return function(i,n){e(i,n,t)}};const tz=new $t;let ez=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;tz.setValue(i.x1,i.y1,i.x2,i.y2),tz.expand(-r/2),h=!tz.containsPoint(e)}}return n.highPerformanceRestore(),h}};ez=Zj([fA(),Qj(0,yA(QB)),Jj("design:paramtypes",[Object])],ez);var iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},nz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sz=function(t,e){return function(i,n){e(i,n,t)}};let rz=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=hI(n,r,n.dpr),o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};rz=iz([fA(),sz(0,yA(GB)),nz("design:paramtypes",[Object])],rz);var az=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lz=function(t,e){return function(i,n){e(i,n,t)}};let hz=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};hz=az([fA(),lz(0,yA(YB)),oz("design:paramtypes",[Object])],hz);var cz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dz=class{constructor(){this.type="image",this.numberType=ME}contains(t,e,i){const{pickContext:n}=null!=i?i:{};return!!n&&!!t.AABBBounds.containsPoint(e)}};dz=cz([fA()],dz);var uz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let pz=class extends JO{};pz=uz([fA()],pz);var gz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vz=function(t,e){return function(i,n){e(i,n,t)}};let mz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;n.highPerformanceSave();const s=fC(t).line,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};mz=gz([fA(),vz(0,yA(qB)),fz("design:paramtypes",[Object])],mz);var yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bz=function(t,e){return function(i,n){e(i,n,t)}};let xz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};xz=yz([fA(),bz(0,yA(ZB)),_z("design:paramtypes",[Object])],xz);var Sz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Az=function(t,e){return function(i,n){e(i,n,t)}};let kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;if(!n.camera){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0}n.highPerformanceSave();const s=fC(t).symbol,r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const s=e.lineWidth||i.lineWidth;return n.lineWidth=hI(n,s,n.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};kz=Sz([fA(),Az(0,yA(eI)),wz("design:paramtypes",[Object])],kz);var Mz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tz=function(t,e){return function(i,n){e(i,n,t)}};let Ez=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=DE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=t.AABBBounds;if(!n.camera)return!!s.containsPoint(e);n.highPerformanceSave();const r=fC(t).text,{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,n,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(n.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,n,h,c,{},null,((e,i,n)=>{if(g)return!0;const{fontSize:s=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),v=jP(a,u,s),m=FP(o,f);return e.rect(m+h,v+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,n.modelMatrix!==u&&SO.free(n.modelMatrix),n.modelMatrix=u,n.highPerformanceRestore(),g}};Ez=Mz([fA(),Tz(0,yA(iI)),Cz("design:paramtypes",[Object])],Ez);var Pz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oz=function(t,e){return function(i,n){e(i,n,t)}};let Bz=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};Bz=Pz([fA(),Oz(0,yA(JB)),Rz("design:paramtypes",[Object])],Bz);var Iz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Lz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Fz=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=BE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Fz=Iz([fA(),Lz(0,yA(nI)),Dz("design:paramtypes",[Object])],Fz);var jz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hz=function(t,e){return function(i,n){e(i,n,t)}};let Nz=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};Nz=jz([fA(),Hz(0,yA(rI)),zz("design:paramtypes",[Object])],Nz);var Vz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Uz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="rect3d",this.numberType=OE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Uz=Vz([fA(),Gz(0,yA(tI)),Wz("design:paramtypes",[Object])],Uz);var Yz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$z=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Kz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="pyramid3d",this.numberType=PE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>!1)),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Kz=Yz([fA(),$z(0,yA(sI)),Xz("design:paramtypes",[Object])],Kz);var qz=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zz=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jz=function(t,e){return function(i,n){e(i,n,t)}};new $t;let Qz=class extends pz{constructor(t){super(),this.canvasRenderer=t,this.type="arc3d",this.numberType=xE}contains(t,e,i){const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();const r=this.transform(t,s,n),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(n.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,n,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,n.modelMatrix!==h&&SO.free(n.modelMatrix),n.modelMatrix=h,n.highPerformanceRestore(),d}};Qz=qz([fA(),Jz(0,yA(UB)),Zz("design:paramtypes",[Object])],Qz);var tH=new cA(((t,e,i,n)=>{t(qj).toSelf().inSingletonScope(),t(AD).toService(qj),t(LD).toService(AD),t(ez).toSelf().inSingletonScope(),t(TD).toService(ez),t(LD).toService(TD),t(Uz).toSelf().inSingletonScope(),t(ED).toService(Uz),t(LD).toService(ED),t(rz).toSelf().inSingletonScope(),t(xD).toService(rz),t(LD).toService(xD),t(hz).toSelf().inSingletonScope(),t(wD).toService(hz),t(LD).toService(wD),t(dz).toSelf().inSingletonScope(),t(kD).toService(dz),t(LD).toService(kD),t(mz).toSelf().inSingletonScope(),t(MD).toService(mz),t(LD).toService(MD),t(xz).toSelf().inSingletonScope(),t(CD).toService(xz),t(LD).toService(CD),t(kz).toSelf().inSingletonScope(),t(PD).toService(kz),t(LD).toService(PD),t(Ez).toSelf().inSingletonScope(),t(RD).toService(Ez),t(LD).toService(RD),t(Bz).toSelf().inSingletonScope(),t(OD).toService(Bz),t(LD).toService(OD),t(Kz).toSelf().inSingletonScope(),t(BD).toService(Kz),t(LD).toService(BD),t(Qz).toSelf().inSingletonScope(),t(SD).toService(Qz),t(LD).toService(SD),t(Fz).toSelf().inSingletonScope(),t(ID).toService(Fz),t(LD).toService(ID),t(Nz).toSelf().inSingletonScope(),t(DD).toService(Nz),t(LD).toService(DD),kA(t,LD)})),eH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},nH=function(t,e){return function(i,n){e(i,n,t)}};let sH=class{constructor(t){this.canvasRenderer=t,this.type="path",this.numberType=TE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).path;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};sH=eH([fA(),nH(0,yA(ZB)),iH("design:paramtypes",[Object])],sH);var rH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},aH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},oH=function(t,e){return function(i,n){e(i,n,t)}};let lH=class{constructor(t){this.canvasRenderer=t,this.type="circle",this.numberType=wE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).circle;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};lH=rH([fA(),oH(0,yA(XB)),aH("design:paramtypes",[Object])],lH);var hH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},dH=function(t,e){return function(i,n){e(i,n,t)}};const uH=new $t;let pH=class{constructor(t){this.canvasRenderer=t,this.type="rect",this.numberType=RE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).rect,{cornerRadius:r=s.cornerRadius}=t.attribute;let{x:a=s.x,y:o=s.y}=t.attribute;n.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);a+=e.x,o+=e.y,n.setTransformForCurrent()}else a=0,o=0,l=!1,n.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||y(r,!0)&&0!==r||f(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,n,a,o,{},null,((t,i,n)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,s)=>{if(h)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,h=t.isPointInStroke(e.x,e.y),h}));else if(h){const{fill:i=s.fill,stroke:n=s.stroke,lineWidth:r=s.lineWidth}=t.attribute;if(i)h=!0;else if(n){const i=t.AABBBounds;uH.setValue(i.x1,i.y1,i.x2,i.y2),uH.expand(-r/2),h=!uH.containsPoint(e)}}return n.highPerformanceRestore(),h}};pH=hH([fA(),dH(0,yA(QB)),cH("design:paramtypes",[Object])],pH);var gH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},vH=function(t,e){return function(i,n){e(i,n,t)}};let mH=class{constructor(t){this.canvasRenderer=t,this.type="arc",this.numberType=bE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).arc;n.highPerformanceSave();let{x:r=s.x,y:a=s.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};mH=gH([fA(),vH(0,yA(GB)),fH("design:paramtypes",[Object])],mH);var yH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},bH=function(t,e){return function(i,n){e(i,n,t)}};let xH=class{constructor(t){this.canvasRenderer=t,this.type="area",this.numberType=SE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).area;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o))),n.highPerformanceRestore(),o}};xH=yH([fA(),bH(0,yA(YB)),_H("design:paramtypes",[Object])],xH);var SH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},AH=function(t,e){return function(i,n){e(i,n,t)}};let kH=class{constructor(t){this.canvasRenderer=t,this.type="line",this.numberType=CE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).line;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,(t=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};kH=SH([fA(),AH(0,yA(qB)),wH("design:paramtypes",[Object])],kH);var MH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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)},TH=function(t,e){return function(i,n){e(i,n,t)}};let EH=class{constructor(t){this.canvasRenderer=t,this.type="symbol",this.numberType=IE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).symbol;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};EH=MH([fA(),TH(0,yA(eI)),CH("design:paramtypes",[Object])],EH);var PH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let RH=class{constructor(){this.type="text",this.numberType=DE}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};RH=PH([fA()],RH);var OH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BH=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},IH=function(t,e){return function(i,n){e(i,n,t)}};let DH=class{constructor(t){this.canvasRenderer=t,this.type="polygon",this.numberType=EE}contains(t,e,i){if(!t.AABBBounds.contains(e.x,e.y))return!1;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=fC(t).polygon;let{x:r=s.x,y:a=s.y}=t.attribute;if(n.highPerformanceSave(),t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(s);r+=e.x,a+=e.y,n.setTransformForCurrent()}else r=0,a=0,n.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,n,r,a,{},null,((t,i,n)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,s)=>{if(o)return!0;const r=i.lineWidth||s.lineWidth;return n.lineWidth=r,o=t.isPointInStroke(e.x,e.y),o})),n.highPerformanceRestore(),o}};DH=OH([fA(),IH(0,yA(JB)),BH("design:paramtypes",[Object])],DH);var LH=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(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,n){e(i,n,t)}};let zH=class{constructor(t){this.canvasRenderer=t,this.type="glyph",this.numberType=AE}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:n}=null!=i?i:{};if(!n)return!1;const s=null==i?void 0:i.pickerService;if(s){let n=!1;return t.getSubGraphic().forEach((t=>{n||(n=!!s.pickItem(t,e,i))})),n}return!1}};zH=LH([fA(),jH(0,yA(rI)),FH("design:paramtypes",[Object])],zH);var HH=new cA((t=>{t(lH).toSelf().inSingletonScope(),t(zD).toService(lH),t(XD).toService(zD),t(pH).toSelf().inSingletonScope(),t(VD).toService(pH),t(XD).toService(VD),t(mH).toSelf().inSingletonScope(),t(FD).toService(mH),t(XD).toService(FD),t(xH).toSelf().inSingletonScope(),t(jD).toService(xH),t(XD).toService(jD),t(kH).toSelf().inSingletonScope(),t(HD).toService(kH),t(XD).toService(HD),t(sH).toSelf().inSingletonScope(),t(ND).toService(sH),t(XD).toService(ND),t(EH).toSelf().inSingletonScope(),t(WD).toService(EH),t(XD).toService(WD),t(RH).toSelf().inSingletonScope(),t(GD).toService(RH),t(XD).toService(GD),t(DH).toSelf().inSingletonScope(),t(UD).toService(DH),t(XD).toService(UD),t(zH).toSelf().inSingletonScope(),t(YD).toService(zH),t(zH).toService(YD),kA(t,XD)}));var NH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new bD(t))).whenTargetNamed(bD.env),t(AM).toDynamicValue((()=>(t,e)=>new vD(t,e))).whenTargetNamed(vD.env)})),VH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new lF(t))).whenTargetNamed(lF.env),t(AM).toDynamicValue((()=>(t,e)=>new sF(t,e))).whenTargetNamed(sF.env)})),WH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new JL(t))).whenTargetNamed(JL.env),t(AM).toDynamicValue((()=>(t,e)=>new $L(t,e))).whenTargetNamed($L.env)})),GH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new yF(t))).whenTargetNamed(yF.env),t(AM).toDynamicValue((()=>(t,e)=>new gF(t,e))).whenTargetNamed(gF.env)})),UH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new zF(t))).whenTargetNamed(zF.env),t(AM).toDynamicValue((()=>(t,e)=>new DF(t,e))).whenTargetNamed(DF.env)})),YH=new cA((t=>{t(wM).toDynamicValue((()=>t=>new EF(t))).whenTargetNamed(EF.env),t(AM).toDynamicValue((()=>(t,e)=>new kF(t,e))).whenTargetNamed(kF.env)}));SM.load(eP),SM.load(lL),SM.load(UI),SM.load(oL),SM.load(fL),function(t){t.load(zL),t.load(UF),t.load(YF),t.load(ej)}(SM),function(t){t.load(Yj)}(SM),function(t){t.load(tH),t.load(HH)}(SM),function(t){t.load(NH),t.load(WH),t.load(VH),t.load(GH),t.load(UH),t.load(YH)}(SM);const XH=SM.get(EA);oM.global=XH;const $H=SM.get(QE);oM.graphicUtil=$H;const KH=SM.get(JE);oM.transformUtil=KH;const qH=SM.get(LE);oM.graphicService=qH,SM.get(oD);const ZH=SM.get(tP);oM.layerService=ZH;class JH{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAttributeUpdate.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()})),oM.graphicService.hooks.onSetStage.tap(this.key,(e=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&e.stage.renderNextFrame()}))}deactivate(t){oM.graphicService.hooks.onAttributeUpdate.taps=oM.graphicService.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onSetStage.taps=oM.graphicService.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}class QH{constructor(){this.name="ViewTransform3dPlugin",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.onMouseDown=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!0,this.pageX=t.page.x,this.pageY=t.page.y)},this.onMouseUp=t=>{this.option3d||(this.option3d=this.pluginService.stage.option3d),this.option3d&&(this.mousedown=!1)},this.onMouseMove=t=>{var e,i;const n=this.pluginService.stage;if(this.option3d||(this.option3d=n.option3d),this.option3d&&this.mousedown)if(this.pageX&&this.pageY){const s=t.page.x-this.pageX,r=t.page.y-this.pageY;this.pageX=t.page.x,this.pageY=t.page.y;const a=s/100,o=r/100;this.option3d.alpha=(null!==(e=this.option3d.alpha)&&void 0!==e?e:0)+a,this.option3d.beta=(null!==(i=this.option3d.beta)&&void 0!==i?i:0)+o,n.set3dOptions(this.option3d),n.renderNextFrame()}else this.pageX=t.page.x,this.pageY=t.page.y}}activate(t){this.pluginService=t;const e=t.stage;this.option3d=e.option3d,e.addEventListener("mousedown",this.onMouseDown),e.addEventListener("mouseup",this.onMouseUp),e.addEventListener("mousemove",this.onMouseMove)}deactivate(t){const e=t.stage;e.removeEventListener("mousedown",this.onMouseDown),e.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("mousemove",this.onMouseMove)}}class tN{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,oM.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,n)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),oM.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){oM.graphicService.hooks.onAddIncremental.taps=oM.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onClearIncremental.taps=oM.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,oM.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 n=e.layer.subLayers.get(e._uid);n&&n.drawContribution&&n.drawContribution.draw(t.renderService,Object.assign({x:t.x,y:t.y,width:i.viewWidth,height:i.viewHeight,stage:t,layer:i,clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:n.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const eN=new $t;class iN{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=vC.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()})),oM.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,n)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(eN.setValue(n.x1,n.y1,n.x2,n.y2),e.dirty(eN,t.parent&&t.parent.globalTransMatrix)))})),oM.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,n,s)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!s||e.dirty(n.globalAABBBounds))})),oM.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){oM.graphicService.hooks.beforeUpdateAABBBounds.taps=oM.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.afterUpdateAABBBounds.taps=oM.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),oM.graphicService.hooks.onRemove.taps=oM.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}class nN{constructor(){this.name="FlexLayoutPlugin",this.activeEvent="onRegister",this.id=vC.GenAutoIncrementId(),this.key=this.name+this.id}tryLayout(t){const e=t.parent;if(!e)return;const i=fC(e).group,{display:n=i.display}=e.attribute;if("flex"!==n)return;const{width:s,height:r,flexDirection:a=i.flexDirection,flexWrap:o=i.flexWrap,justifyContent:l=i.justifyContent,alignItems:h=i.alignItems,alignContent:c=i.alignContent}=e.attribute;if(!s||!r)return;const d={main:{len:s,field:"x"},cross:{len:r,field:"y"},dir:1},u=d.main,p=d.cross;"row-reverse"===a?d.dir=-1:"column"===a?(u.len=r,p.len=s,u.field="y",p.field="x"):"column-reverse"===a&&(u.len=r,p.len=s,u.field="y",p.field="x",d.dir=-1);let g=0,f=0;const v=[];e.forEachChildren((t=>{const e=t.AABBBounds,i="x"===u.field?e.width():e.height(),n="x"===p.field?e.width():e.height();v.push({mainLen:i,crossLen:n}),g+=i,f=Math.max(f,n)}));const m=[];if(g>u.len&&"wrap"===o){let t=0,e=0;v.forEach(((i,n)=>{let{mainLen:s,crossLen:r}=i;t+s>u.len?0===t?(m.push({idx:n,mainLen:t+s,crossLen:r}),t=0,e=0):(m.push({idx:n-1,mainLen:t,crossLen:r}),t=s,e=r):(t+=s,e=Math.max(e,r))})),m.push({idx:v.length-1,mainLen:t,crossLen:e})}else m.push({idx:v.length-1,mainLen:g,crossLen:f});const y=e.getChildren();let _=0;if(m.forEach((t=>{this.layoutMain(e,y,l,u,v,_,t),_=t.idx+1})),f=m.reduce(((t,e)=>t+e.crossLen),0),1===m.length){if("flex-end"===h){const t=p.len;this.layoutCross(y,h,p,t,v,m[0],0)}else if("center"===h){const t=p.len/2;this.layoutCross(y,h,p,t,v,m[0],0)}}else if("flex-start"===c){_=0;let t=0;m.forEach(((e,i)=>{this.layoutCross(y,"flex-start",p,t,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("center"===c){_=0;let t=Math.max(0,(p.len-f)/2);m.forEach(((e,i)=>{this.layoutCross(y,"center",p,t+e.crossLen/2,v,m[i],_),_=e.idx+1,t+=e.crossLen}))}else if("space-around"===c){_=0;const t=Math.max(0,(p.len-f)/m.length/2);let e=t;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}else if("space-between"===c){_=0;const t=Math.max(0,(p.len-f)/(2*m.length-2));let e=0;m.forEach(((i,n)=>{this.layoutCross(y,"flex-start",p,e,v,m[n],_),_=i.idx+1,e+=i.crossLen+2*t}))}}layoutMain(t,e,i,n,s,r,a){if("flex-start"===i){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else if("flex-end"===i){let t=n.len;for(let i=r;i<=a.idx;i++)t-=s[i].mainLen,e[i].attribute[n.field]=t}else if("space-around"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/t/2;let o=i;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}else if("space-between"===i)if(a.mainLen>=n.len){let t=0;for(let i=r;i<=a.idx;i++)e[i].attribute[n.field]=t,t+=s[i].mainLen}else{const t=a.idx-r+1,i=(n.len-a.mainLen)/(2*t-2);let o=0;for(let t=r;t<=a.idx;t++)e[t].attribute[n.field]=o,o+=s[t].mainLen+2*i}}layoutCross(t,e,i,n,s,r,a){if("flex-end"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen;else if("center"===e)for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n-s[e].crossLen/2;else for(let e=a;e<=r.idx;e++)t[e].attribute[i.field]=n}activate(t){this.pluginService=t,qH.hooks.onAttributeUpdate.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)})),qH.hooks.onSetStage.tap(this.key,(t=>{t.glyphHost&&(t=t.glyphHost),this.tryLayout(t)}))}deactivate(t){qH.hooks.onAttributeUpdate.taps=qH.hooks.onAttributeUpdate.taps.filter((t=>t.name!==this.key)),qH.hooks.onSetStage.taps=qH.hooks.onSetStage.taps.filter((t=>t.name!==this.key))}}const sN=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===FC.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=FC.INITIAL,oM.global.hooks.onSetEnv.tap("window",(()=>{this.initHandler()})),oM.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:LC},{mode:"timeout",cons:DC},{mode:"manual",cons:IC}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==FC.INITIAL&&(this.status=FC.PAUSE,!0)}resume(){return this.status!==FC.INITIAL&&(this.status=FC.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===FC.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===FC.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=FC.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=FC.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};sN.addTimeline(zC),sN.setFPS(60);class rN{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.dir=t,this.color=e,this.colorRgb=FT.get(e).value,this.colorRgb[0]/=255,this.colorRgb[1]/=255,this.colorRgb[2]/=255,this.ambient=i;const n=Dt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);this.formatedDir=[t[0]/n,t[1]/n,t[2]/n]}computeColor(t,e){const i=this.formatedDir,n=Bt(Ot((t[0]*i[0]+t[1]*i[1]+t[2]*i[2])*(1-this.ambient/2),0)+this.ambient,1);let s;s=g(e)?FT.get(e).value:e;const r=this.colorRgb;return FT.to.rgb(r[0]*s[0]*n,r[1]*s[1]*n,r[2]*s[2]*n)}}const aN="white";class oN extends zE{set viewBox(t){this._viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}get viewBox(){return this._viewBox}get x(){return this._viewBox.x1}set x(t){this._viewBox.translate(t-this._viewBox.x1,0)}get y(){return this._viewBox.y1}set y(t){this._viewBox.translate(0,t-this._viewBox.y1)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this._viewBox.width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this._viewBox.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:aN}set background(t){this._background=t}get defaultLayer(){return this.at(0)}constructor(t){var e;super({}),this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.theme=new pC,this.hooks={beforeRender:new CA(["stage"]),afterRender:new CA(["stage"])},this.global=SM.get(EA),this.window=SM.get(KE),this.renderService=SM.get(WI),this.pickerService=SM.get(iD),this.pluginService=SM.get(cL),this.layerService=SM.get(tP),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this._viewBox=new $t,t.viewBox?this._viewBox.setValue(t.viewBox.x1,t.viewBox.y1,t.viewBox.x2,t.viewBox.y2):this._viewBox.setValue(0,0,this.width,this.height),this.renderCount=0,this._subView=!(this._viewBox.width()===this.width&&this._viewBox.height()===this.height),this._background=null!==(e=t.background)&&void 0!==e?e:aN,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,this.global.supportEvent&&(this.eventSystem=new EC({targetElement:this.window,resolution:this.window.dpr||this.global.devicePixelRatio,rootNode:this,global:this.global,viewport:{viewBox:this._viewBox,get x(){return this.viewBox.x1},get y(){return this.viewBox.y1},get width(){return this.viewBox.width()},get height(){return this.viewBox.height()}}})),t.autoRender&&this.enableAutoRender(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||sN,this.supportInteractiveLayer=!1!==t.interactiveLayer}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:n=0,beta:s=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:n,beta:s,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,n,s,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:v="white",ambient:m}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(n=h.y)&&void 0!==n?n:this.height/2)+(null!==(s=h.dy)&&void 0!==s?s: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,w=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,w=Math.cos(d)*Math.cos(u)*1),this.light=new rN(f,v,m);const A={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,w],center:b,up:[0,1,0]}};this.camera?this.camera.params=A:this.camera=new dD(A),t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){this.view3dTranform||(this.view3dTranform=!0,this.pluginService.register(new QH))}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new JH))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new tN))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Xt;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t||(t=new iN,this.pluginService.register(t)),t.activate(this.pluginService)}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}enableLayout(){this._enableLayout||(this._enableLayout=!0,this.pluginService.register(new nN))}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{t.deactivate(this.pluginService)})))}tryUpdateAABBBounds(){const t=this._viewBox;return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t){const e=this.layerService.createLayer(this,{main:!1,canvasId:t});return this.appendChild(e),e}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(){this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive")}clearViewBox(t){this.window.clearViewBox(this._viewBox,t)}render(t,e){this.ticker.start(),this.lastRenderparams=e,this.hooks.beforeRender.call(this),(t||this).forEach(((t,i)=>{t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},e))})),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear(),this.hooks.afterRender.call(this)}combineLayersToWindow(){this.forEach(((t,e)=>{t.combineTo(this.window,{clear:0===e,x:this.x,y:this.y,width:this.viewWidth,height:this.viewHeight,renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds})}))}renderNextFrame(t){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){this.nextFrameRenderLayerSet.size&&(this.ticker.start(),this.hooks.beforeRender.call(this),this.forEach((t=>{this.nextFrameRenderLayerSet.has(t)&&t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!!this.dirtyBounds},Object.assign({renderStyle:this.renderStyle},this.lastRenderparams||{}))})),this.combineLayersToWindow(),this.hooks.afterRender.call(this),this.nextFrameRenderLayerSet.clear())}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this._subView||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render()}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];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,n,s){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+n),!1===s&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){const i=this.pickerService.pick(this.children,new Gt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.eventSystem&&this.eventSystem.release(),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&this.interactiveLayer.release(),this.window.release()}setStage(t){}dirty(t,e){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,e){this.forEachChildren(((i,n)=>{i.drawTo(t,Object.assign(Object.assign({},e),{renderService:this.renderService,background:i===this.defaultLayer?this.background:void 0,clear:0===n,updateBounds:!!this.dirtyBounds}))}))}renderToNewWindow(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=SM.get(KE);return t?e.create({width:this.viewWidth,height:this.viewHeight,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}):e.create({width:Math.min(this.viewWidth,this.window.width-this.x),height:Math.min(this.viewHeight,this.window.height-this.y),dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e,{x:0,y:0,width:e.width,height:e.height}),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=this.renderToNewWindow(t).getNativeHandler();return e.nativeCanvas?e.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t)}getCursor(){return this._cursor}}var lN;!function(t){t[t.W=1]="W",t[t.H=2]="H",t[t.WH=3]="WH"}(lN||(lN={}));const hN="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",cN=14,dN=32,uN=20,pN=16,gN="150%",fN=14,vN="150%",mN=12,yN="130%",_N=10,bN="120%",xN=4,SN=.2,wN=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:hN,fontSize:cN},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function AN(t,e){for(let i=0;it.key===e))}function MN(t,e){var i;if(!t)return null!=e?e:null;const n=t.getFields();return n&&n[e]?null!==(i=n[e].alias)&&void 0!==i?i:e:null!=e?e:null}const CN=(t,e,i="key",n="children")=>{for(let s=0;s{for(let s=0;sON(t.style(e,i,n,s)):C(t.style)||(e.style=ON(t.style)),!C(t.state)){const i={};Object.keys(t.state).forEach((e=>{o(t.state[e])?i[e]=(i,n,s,r)=>ON(t.state[e](i,n,s,r)):C(t.state[e])||(i[e]=ON(t.state[e]))})),e.state=i}return e}function PN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e,n,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function RN(t){if(C(t))return null;const e={};return Object.keys(t).forEach((i=>{o(t[i])?e[i]=(e,n,s,r)=>ON(t[i](e.rawValue,n,e,s,r)):C(t[i])||(e[i]=ON(t[i]))})),e}function ON(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}class BN{static registerChart(t,e){BN._charts[t]=e}static registerSeries(t,e){BN._series[t]=e}static registerComponent(t,e){BN._components[t]=e}static registerMark(t,e){BN._marks[t]=e}static registerRegion(t,e){BN._regions[t]=e}static registerTransform(t,e){BN.transforms[t]=e}static registerLayout(t,e){BN._layout[t]=e}static createChart(t,e,i){if(!BN._charts[t])return null;return new(0,BN._charts[t])(e,i)}static createRegion(t,e,i){if(!BN._regions[t])return null;return new(0,BN._regions[t])(e,i)}static createSeries(t,e,i){if(!BN._series[t])return null;return new(0,BN._series[t])(e,i)}static createMark(t,e,i){if(!BN._marks[t])return null;const n=new(0,BN._marks[t])(e,i);return n.type===Hh.group&&n.setInteractive(!1),n}static getComponents(){return Object.values(BN._components)}static getComponentInKey(t){return BN._components[t]}static getLayout(t){return BN._layout[t]}static getSeries(t){return BN._series[t]}}BN._charts={},BN._series={},BN._components={},BN._marks={},BN._regions={},BN.transforms={simplify:Ea,fields:Ra,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:n,value:s,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[n]=o,l[s]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const n in t[e])-1===i.indexOf(n)&&(l[n]=t[e][n]);a.push(l)}));return a}},BN.dataParser={csv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,za(t)},dsv:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Pa.DSV;const i=ka(Na,e),{delimiter:n}=i;if(!g(n))throw new TypeError("Invalid delimiter: must be a string!");return ja(n).parse(t)},tsv:function(t){return(arguments.length>2?arguments[2]:void 0).type=Pa.DSV,Ha(t)}},BN._layout={};const IN="__VCHART",DN=500,LN=500,FN=`${IN}_LABEL_LIMIT`,jN=`${IN}_LABEL_ALIGN`,zN=`${IN}_LABEL_TEXT`,HN=`${IN}_LABEL_VISIBLE`,NN=`${IN}_LABEL_X`,VN=`${IN}_LABEL_Y`,WN=`${IN}_ARC_RATIO`,GN=`${IN}_ARC_START_ANGLE`,UN=`${IN}_ARC_END_ANGLE`,YN=`${IN}_ARC_K`,XN=`${IN}_ARC_LABEL_POINT_BX`,$N=`${IN}_ARC_LABEL_POINT_BY`,KN=`${IN}_ARC_LABEL_POINT_CX`,qN=`${IN}_ARC_LABEL_POINT_CY`,ZN=`${IN}_ARC_MIDDLE_ANGLE`,JN=`${IN}_ARC_QUADRANT`,QN=`${IN}_ARC_RADIAN`,tV=-Math.PI/2,eV=3*Math.PI/2,iV=-90,nV=270,sV=.6,rV={},aV=[],oV=(t,e,i)=>{rV[t]=Object.assign(e,{type:t}),i||aV.push(t)},lV=()=>{aV.slice().forEach((t=>{(t=>{delete rV[t];const e=aV.indexOf(t);e>=0&&aV.splice(e,1)})(t)}))},hV=(t,e,i,n,s,r)=>{const a=[i[0]>=r?1:0,i[1]>=r?1:0,i[2]>=r?1:0,i[3]>=r?1:0],o=[];a[0]!==a[1]&&o.push({id:`${t}-${e-1}-${t}-${e}`,currentCell:e*s+t,nextCell:(e-1)*s+t,point:{x:t+(r-i[0])/(i[1]-i[0]),y:e},siblingPoint:null}),a[1]!==a[2]&&o.push({id:`${t}-${e}-${t+1}-${e}`,currentCell:e*s+t,nextCell:e*s+t+1,point:{x:t+1,y:e+(r-i[1])/(i[2]-i[1])},siblingPoint:null}),a[2]!==a[3]&&o.push({id:`${t}-${e}-${t}-${e+1}`,currentCell:e*s+t,nextCell:(e+1)*s+t,point:{x:t+(r-i[3])/(i[2]-i[3]),y:e+1},siblingPoint:null}),a[3]!==a[0]&&o.push({id:`${t-1}-${e}-${t}-${e}`,currentCell:e*s+t,nextCell:e*s+t-1,point:{x:t,y:e+(r-i[0])/(i[3]-i[0])},siblingPoint:null});const l=(8&a[0])+(4&a[1])+(2&a[2])+(1&a[3]);return 6===l||9===l?(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0],o[2].siblingPoint=o[3],o[3].siblingPoint=o[2]):2===o.length&&(o[0].siblingPoint=o[1],o[1].siblingPoint=o[0]),o},cV=(t,e)=>{const i=t.siblingPoint,n=dV(t,e);return"loop"===n.result?n.points:dV(i,e).points.reverse().concat(n.points)},dV=(t,e)=>{const i=[t];let n=t;const s=t=>t.id===n.id;let r="break";do{const t=e[n.nextCell],a=null==t?void 0:t.find(s);if(a){if(n=a.siblingPoint,i.includes(n)){r="loop",i.push(n);break}if(!n)break;i.push(n)}else n=null}while(n);return{points:i,result:r}},uV=["x","kde"],pV=["x","y","kde"],gV=Math.sqrt(2*Math.PI),fV=Math.sqrt((2*Math.PI)**2),vV=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=1===e?gV:2===e?fV:Math.sqrt((2*Math.PI)**e);return Math.exp(-(t**2)/2)/i},mV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Math.abs(t.x-n.x);return e+vV(s/i,1)}),0)/(n*i)},yV=(t,e,i)=>{const n=e.length;return e.reduce(((e,n)=>{const s=Ut.distancePP(t,n);return e+vV(s/i**2,1)}),0)/(n*i**2)},_V=(t,e)=>{const i=qe.getInstance();let n=t.as;const{fields:s,from:r,key:a,values:o}=t,h=Io(a),c=(r||[]).reduce(((t,e)=>(t[h(e)]=e,t)),{}),d=l(t.default)?null:t.default,u=s.map((t=>Io(t)));if(o){s.length>1&&!n&&i.error('Multi-field lookup requires explicit "as" parameter.'),n&&n.length!==s.length*o.length&&i.error('The "as" parameter has too few output field names.'),l(n)&&(n=o);const t=o.map((t=>Io(t)));return e.map((e=>u.reduce(((i,s,r)=>{const a=c[s(e)],h=o.length;return(l(a)?t.map((t=>d)):t.map((t=>t(a)))).reduce(((t,e,i)=>(t[n[r*h+i]]=e,t)),i)}),e)))}return n||i.error("Missing output field names."),e.map((t=>u.reduce(((e,i,s)=>{const r=c[i(t)];return e[n[s]]=l(r)?d:r,e}),t)))};function bV(t,e){return t?t.map(((t,i)=>{var n,s;return null!==(n=e[i])&&void 0!==n?n:g(t)?t:l(s=t)?null:s.fname})):null}function xV(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 SV(t,e){return V(t).reduce(((t,i)=>{const n=g(i)?e.getGrammarById(i):i;return n&&t.push(n),t}),[])}function wV(t,e){if(l(t))return[];if(!o(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(g(i))return V(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!o(t)&&!!(null==t?void 0:t.callback)}(t))return SV(t.dependency,e);var i;return[]}function AV(t){return o(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function kV(t,e,i,n){if(l(t))return t;if(o(t))return n?t.call(null,i,n,e):t.call(null,i,e);if(t.signal){const i=t.signal;return g(i)?null==e?void 0:e[i]:i.output()}return t.callback?n?t.callback.call(null,i,n,e):t.callback.call(null,i,e):t}function MV(t,e){return CV(t)?t.output():e[t]}const CV=t=>t&&!l(t.grammarType),TV=t=>o(t)?t:e=>e[t],EV=t=>g(t)&&de.parseColorString(t)?t:null;var PV,RV,OV,BV,IV,DV,LV,FV,jV,zV,HV,NV,VV;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group"}(PV||(PV={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(RV||(RV={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(OV||(OV={})),function(t){t.axis="axis",t.crosshair="crosshair",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.tooltip="tooltip",t.dimensionTooltip="dimensionTooltip"}(BV||(BV={})),function(t){t[t.player=1]="player",t[t.slider=2]="slider",t[t.datazoom=3]="datazoom",t[t.legend=4]="legend"}(IV||(IV={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(DV||(DV={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(LV||(LV={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(FV||(FV={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(jV||(jV={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(zV||(zV={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(HV||(HV={})),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"}(NV||(NV={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(VV||(VV={}));const WV="__vgrammar_scene_item__",GV=[OV.line,OV.area],UV=[OV.arc3d,OV.rect3d,OV.pyramid3d],YV="key",XV=[{}],$V=["key"],KV="VGRAMMAR_IMMEDIATE_ANIMATION",qV=0,ZV=1e3,JV=0,QV=!1,tW=!1,eW="quintInOut",iW={stopWhenStateChange:!1,immediatelyApply:!0};function nW(t,e,i){const n=new Map;if(!t||0===t.length)return{keys:[],data:n};if(!e)return n.set(YV,i?t.slice().sort(i):t.slice()),{keys:$V,data:n};const s=TV(e),r=new Set;return t.forEach((t=>{var e;const i=s(t),a=null!==(e=n.get(i))&&void 0!==e?e:[];a.push(t),n.set(i,a),r.add(i)})),i&&r.forEach((t=>{n.get(t).sort(i)})),{keys:Array.from(r),data:n}}class sW{constructor(t,e,i){this.prevData=nW(null!=t?t:[],null!=e?e:null,i)}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}}setCallback(t){this.callback=t}updateToCurrent(){var t;this.prevData=null!==(t=this.currentData)&&void 0!==t?t:{keys:[],data:new Map},this.currentData=null}reset(){this.prevData={keys:[],data:new Map}}}function rW(t,e,i,n){const s=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}const aW=":vGrammar_identifier:";function oW(t){return!!(null==t?void 0:t.scale)}function lW(t){return!!(null==t?void 0:t.field)}function hW(t,e){if(!t)return[];let i=[];return t.scale&&(i=CV(t.scale)?[t.scale]:V(e.getScaleById(t.scale))),i.concat(wV(t,e))}class cW{constructor(t,e,i,n){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(n)}getMarks(){return this.marks}registerChannelEncoder(t,e){return g(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=V(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}const dW={},uW=t=>dW[t],pW=(t,e,i,n,s)=>(dW[t]=new cW(e,i,n,s),dW[t]);function gW(t){return null===t?0:t}function fW(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}const vW=["fillOpacity","x","y","dx","dy"],mW=(t,e,i)=>{var n;return"fillOpacity"===e?(t.fillOpacity=null!==(n=i.fillOpacity)&&void 0!==n?n:1,["fillOpacity"]):"x"===e?(t.x=gW(i.x),["x"]):"y"===e?(t.y=gW(i.y),["y"]):"dx"===e?(t.dx=gW(i.dx),["dx"]):"dy"===e?(t.dy=gW(i.dy),["dy"]):[]};const yW={[OV.largeRects]:[{channels:["x","y","y1","x1","width","height"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.largeSymbols]:[{channels:["x","y","size"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.area]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{t.x=0,t.y=0,t.x1=0,t.y1=0}}],[OV.line]:[{channels:["x","y","defined","enableSegments"],transform:(t,e,i)=>{t.x=0,t.y=0}}],[OV.rect]:[{channels:["x","y","x1","y1","width","height"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height)},storedAttrs:"sizeAttrs"}],rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;_(e.width)||!_(e.x1)&&_(i.width)?(t.x=Math.min(null!==(n=i.x)&&void 0!==n?n:0,null!==(s=i.x1)&&void 0!==s?s:1/0),t.width=i.width):_(e.x1)||!_(e.width)&&_(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),_(e.height)||!_(e.y1)&&_(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):_(e.y1)||!_(e.height)&&_(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),_(e.length)||!_(e.z1)&&_(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):_(e.z1)||!_(e.length)&&_(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[OV.text]:[{channels:["text","limit","autoLimit","maxLineWidth"],transform:(t,e,i)=>{var n,s;const r=null!==(n=i.limit)&&void 0!==n?n:1/0,a=null!==(s=i.autoLimit)&&void 0!==s?s:1/0,o=Math.min(r,a);Array.isArray(i.text),t.maxLineWidth=o===1/0?i.maxLineWidth:o,t.text=i.text},storedAttrs:"limitAttrs"}],[OV.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const n=function(t){const{x:e,y:i,x1:n,y1:s}=t;return _(e)&&_(i)&&_(n)&&_(s)?[{x:e,y:i},{x:n,y:s}]:[]}(i);t.points=n,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[OV.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var n;t.symbolType=null!==(n=e.shape)&&void 0!==n?n:e.symbolType}}]};const _W=(t,e,i,n)=>{const s={},r=Object.keys(e),a=g(t)?yW[t]:t;if(null==a?void 0:a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,n,s,r){var a;const o=null!==(a=s.getGraphicAttribute(t,!1,r))&&void 0!==a?a:{},l={};return e.forEach((t=>{var e;return l[t]=null!==(e=n[t])&&void 0!==e?e:o[t]})),i[t]=l,l}(a.storedAttrs,a.channels,s,e,i,n);a.transform(s,e,t)}else a.transform(s,e,null);t[l]=!0,o=!0}})),o||(vW.includes(r)?mW(s,r,e):s[r]=e[r])}))}else r.forEach((t=>{vW.includes(t)?mW(s,t,e):s[t]=e[t]}));return s},bW=(t,e,i)=>!(!l(t)||!l(e))||!l(t)&&!l(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(g(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),n=Object.keys(e);return i.length===n.length&&i.every((i=>"stops"===i?((t,e)=>{var i,n;if(t===e)return!0;const s=null!==(i=t&&t.length)&&void 0!==i?i:0;return s===(null!==(n=e&&e.length)&&void 0!==n?n:0)&&0!==s&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),xW=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],SW=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(xW);function wW(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case OV.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case OV.group:case OV.rect:case OV.image:return["width","height","y1"].includes(e);case OV.path:case OV.shape:return["path","customPath"].includes(e);case OV.line:return"defined"===e;case OV.area:return["x1","y1","defined"].includes(e);case OV.rule:return["x1","y1"].includes(e);case OV.symbol:return"size"===e;case OV.polygon:return"points"===e;case OV.text:return"text"===e}return!1}function AW(t,e,i,n,s){i&&(AV(i)?e.forEach((e=>{const s=kV(i,n,e.datum,t);Object.assign(e.nextAttrs,s)})):Object.keys(i).forEach((r=>{var a,o;const h=i[r],c=s&&!wW(t.mark.markType,r)?[e[0]]:e;if(oW(h)){const t=MV(h.scale,n),e=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,i=!l(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,s=g(null==h?void 0:h.field),d=s?Io(h.field):null;let u=s?null:l(null==h?void 0:h.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,h.value);c.forEach((n=>{var a;s&&(u=null===(a=t.scale)||void 0===a?void 0:a.call(t,d(n.datum))),n.nextAttrs[r]=y(u)||y(i)?u+e+i:u}))}else if(lW(h)){const t=Io(h.field);c.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else c.forEach((e=>{e.nextAttrs[r]=kV(h,n,e.datum,t)}))})))}function kW(t,e,i,n){if(!t)return null;if(AV(t))return kV(t,n,e,i);const s={};return Object.keys(t).forEach((r=>{var a,o,h;const c=t[r];if(oW(c)){const t=MV(c.scale,n),i=null!==(a=null==c?void 0:c.offset)&&void 0!==a?a:0,d=!l(c.band)&&t.bandwidth?t.bandwidth()*c.band:null,u=g(null==c?void 0:c.field),p=u?Io(c.field):null,f=u?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):l(null==c?void 0:c.value)?0:null===(h=t.scale)||void 0===h?void 0:h.call(t,c.value);s[r]=y(f)||y(d)?f+i+d:f}else if(lW(c)){const t=Io(c.field);s[r]=t(e)}else s[r]=kV(c,n,e,i)})),s}function MW(t){return t&&(t.type===al.Band||t.type===al.Point)}function CW(t){if(t)return t.type===al.Band?t.bandwidth():t.type===al.Point?t.step():void 0}const TW={bin:{transform:(t,e)=>{if(!e||0===e.length)return e;const{extent:i,step:n}=t,s=h(t.bins)?Math.max(t.bins,1):10,r=i[1]-i[0],a=h(n)?n:r/s;return e.map((e=>{var n,s,r,o;const l=Object.assign({},e),h=e[t.field],c=Math.floor((h-i[0])/a),d=i[0]+c*a,u=Math.min(i[1],i[0]+(c+1)*a);return l[null!==(s=null===(n=t.as)||void 0===n?void 0:n[0])&&void 0!==s?s:"binStart"]=d,l[null!==(o=null===(r=t.as)||void 0===r?void 0:r[1])&&void 0!==o?o:"binEnd"]=u,l}))},markPhase:"beforeJoin"},contour:{transform:(t,e)=>{var i;if(!e||0===e.length)return e;const n=t.row,s=t.column,r=n-1,a=s-1,o=e.map((e=>e[t.field])),l=[Math.min.apply(null,o),Math.max.apply(null,o)],c=null!==(i=t.thresholds)&&void 0!==i?i:[];if(!h(t.thresholds)&&_(t.levels)){const e=(l[1]-l[0])/t.levels;for(let i=1;i{var i,o;const l=[],h=[];for(let t=0;tt.id));c=c.filter((t=>!a.includes(t.id)));const l={[null!==(i=t.asThreshold)&&void 0!==i?i:"threshold"]:e,[null!==(o=t.asPoints)&&void 0!==o?o:"points"]:r.map((t=>({x:t.point.x/n,y:t.point.y/s})))};u.push(l)}}while(c.length>0)})),u},markPhase:"beforeJoin"},sort:{transform:(t,e)=>{const i=t.sort;if(i&&e){const t=o(i)?i:zo(i.field,i.order);e.sort(((e,i)=>t(e,i)))}return e},markPhase:"beforeJoin"},filter:{transform:(t,e,i)=>e.filter((e=>t.callback(e,i))),markPhase:"beforeJoin"},join:{transform:_V,markPhase:"beforeJoin"},kde:{transform:(t,e)=>{var i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,_,b,x,S,w;if(!e||0===e.length)return e;const A=null!==(i=t.dimension)&&void 0!==i?i:"1d",k=V(t.field),M=V(null!==(n=t.bins)&&void 0!==n?n:256),C=V(t.as);if("1d"===A){const i=e.map((t=>({x:t[k[0]]}))),n=null!==(s=t.bandwidth)&&void 0!==s?s:function(t){const e=t.length,i=t.reduce(((t,e)=>t+e.x),0)/e,n=Math.sqrt(t.reduce(((t,e)=>t+(e.x-i)**2),0)/e),s=t.sort(((t,e)=>t.x-e.x)).map((t=>t.x)),r=q(s,.25),a=q(s,.75)-r;return.9*Math.min(n,a/1.34)*e**-.2}(i),d=i.reduce(((t,e)=>Math.min(t,e.x)),i[0].x),u=i.reduce(((t,e)=>Math.max(t,e.x)),i[0].x),p=null!==(a=null===(r=t.extent)||void 0===r?void 0:r[0])&&void 0!==a?a:d,g=null!==(l=null===(o=t.extent)||void 0===o?void 0:o[1])&&void 0!==l?l:u,f=[y(p)?p:null!==(h=p.x)&&void 0!==h?h:d,y(g)?g:null!==(c=g.x)&&void 0!==c?c:u],v=(f[1]-f[0])/M[0],m=new Array(M[0]).fill(0).map(((t,e)=>{var s,r;const a=Math.min(f[0]+v*(e+.5),f[1]);return{[null!==(s=C[0])&&void 0!==s?s:uV[0]]:a,[null!==(r=C[1])&&void 0!==r?r:uV[0]]:mV({x:a},i,n)}}));return m}if("2d"===A){const i=e.map((t=>({x:t[k[0]],y:t[k[1]]}))),n=t.bandwidth||function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t.length**(-1/(e+4))}(i,2),s=i.reduce(((t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y)})),i[0]),r=i.reduce(((t,e)=>({x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)})),i[0]),a=null!==(u=null===(d=t.extent)||void 0===d?void 0:d[0])&&void 0!==u?u:s,o=null!==(g=null===(p=t.extent)||void 0===p?void 0:p[1])&&void 0!==g?g:r,l=[y(a)?{x:a,y:a}:{x:null!==(f=a.x)&&void 0!==f?f:s.x,y:null!==(v=a.y)&&void 0!==v?v:s.y},y(o)?{x:o,y:o}:{x:null!==(m=o.x)&&void 0!==m?m:r.x,y:null!==(_=o.y)&&void 0!==_?_:r.y}],h=M[0],c=null!==(b=M[1])&&void 0!==b?b:M[0],A=(l[1].x-l[0].x)/h,T=(l[1].y-l[0].y)/c,E=[];for(let t=0;t{const n=t.callback,s=t.as;if(!t.all)return e.forEach((t=>{const e=n(t,i);if(!l(s)){if(l(t))return;t[s]=e}return e})),e;const r=n(e,i);return l(s)||l(e)?r:(e[s]=r,e)},markPhase:"beforeJoin"},lookup:{transform:_V,markPhase:"beforeJoin"},pick:{transform:(t,e)=>{const{fields:i=[]}=t,n=bV(i,t.as||[]),s=i.map((t=>g(t)?Io(t):t));return s.length?e.map(((t,e)=>function(t,e,i){return e.reduce(((e,n,s)=>(e[i[s]]=n(t),e)),{})}(t,s,n))):e.map(((t,e)=>({})))},markPhase:"beforeJoin"},range:{transform:t=>{const{start:e,stop:i,step:n=1,as:s="data"}=t;return X(e,i,n).map((t=>({[s]:t})))},markPhase:"beforeJoin"},stack:{transform:(t,e)=>{var i;const n=null!==(i=t.offset)&&void 0!==i?i:"diverging",s=((t,e)=>{var i;const n=new Map,s=new Map,r=null!==(i=t.offset)&&void 0!==i?i:"diverging";return e.map((e=>{var i;const a=e[t.dimensionField],o="diverging"===r?e[t.stackField]:Math.abs(e[t.stackField]),l=o>=0?n:s,h=null!==(i=l.get(a))&&void 0!==i?i:0,c=o+h;return l.set(a,c),{dimension:a,value:o,stack:c,prevStack:h,datum:e}}))})(t,"negative"===t.order?e.slice().reverse():e);"silhouette"===n?((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=-e.reduce(((t,e)=>t+e.value),0)/2;e.forEach((t=>{t.stack=t.stack+n,t.prevStack=t.prevStack+n}))}))})(0,s):"wiggle"===n&&((t,e)=>{if(!e||0===e.length)return e;const i=nW(e,Io("dimension"));i.keys.forEach((t=>{const e=i.data.get(t);if(!e||e.length<=0)return 0;const n=e.length,s=-1/(n+1)*e.reduce(((t,e,i)=>e.value*(n-i+1)),0);e.forEach((t=>{t.stack=t.stack+s,t.prevStack=t.prevStack+s}))}))})(0,s);const r=((t,e)=>{if(!(t.asPercentStack||t.asPrevPercentStack||t.asPercent||t.asSum))return e.map((e=>{var i;const{stack:n,prevStack:s,datum:r}=e,a=Object.assign({},r);return a[null!==(i=t.asStack)&&void 0!==i?i:t.stackField]=n,t.asPrevStack&&(a[t.asPrevStack]=s),a}));const i=new Map,n=new Map;return e.forEach((t=>{var e;const{dimension:s,value:r}=t,a=r>=0?i:n;a.set(s,(null!==(e=a.get(s))&&void 0!==e?e:0)+r)})),e.map((e=>{var s,r;const{dimension:a,value:o,stack:l,prevStack:h,datum:c}=e,d=Object.assign({},c),u=null!==(s=(o>=0?i:n).get(a))&&void 0!==s?s:0;return d[null!==(r=t.asStack)&&void 0!==r?r:t.stackField]=l,t.asPrevStack&&(d[t.asPrevStack]=h),t.asSum&&(d[t.asSum]=u),t.asPercent&&(d[t.asPercent]=0===u?0:o/u),t.asPercentStack&&(d[t.asPercentStack]=0===u?0:l/u),t.asPrevPercentStack&&(d[t.asPrevPercentStack]=0===u?0:h/u),d}))})(t,s);return"negative"===t.order?r.reverse():r},markPhase:"beforeJoin"},funnel:{transform:(t,e)=>{var i,n;const{field:s,asTransformRatio:r,asReachRatio:a,asHeightRatio:o,asValueRatio:l,asNextValueRatio:h,asLastValueRatio:c,asLastValue:d,asCurrentValue:u,asNextValue:p,heightVisual:g=!1,isCone:f=!0,range:v}=t,m=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s])||-1/0)),-1/0),y=e.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[s])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(n=null==v?void 0:v.max)&&void 0!==n?n:m],x=e.map(((t,i)=>{var n,v;const m=Object.assign({},t),y=Number.parseFloat(m[s]),x=Number.parseFloat(null===(n=e[i-1])||void 0===n?void 0:n[s]),S=Number.parseFloat(null===(v=e[i+1])||void 0===v?void 0:v[s]),w=_(S*y)?S/y:null,A=_(y*y)?y/x:null;return d&&(m[d]=x),p&&(m[p]=S),r&&(m[r]=w),a&&(m[a]=0===i?1:A),o&&(m[o]=!0===g?w:1/e.length),l&&(m[l]=y/b[1]),h&&(m[h]=i===e.length-1?f?0:m[l]:S/b[1]),c&&(m[c]=0===i?1:x/b[1]),u&&(m[u]=y),m}));return x},markPhase:"beforeJoin"},pie:{transform:(t,e)=>{var i,n;if(!e||0===e.length)return e;const s=t.field,r=null!==(i=t.startAngle)&&void 0!==i?i:0,a=null!==(n=t.endAngle)&&void 0!==n?n:2*Math.PI,{asStartAngle:o,asEndAngle:l,asMiddleAngle:h,asRadian:c,asRatio:d,asQuadrant:u,asK:p}=t,g=e.reduce(((t,e)=>Number.parseFloat(e[s])+t),0),f=e.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[s]))),-1/0),v=a-r;let m=r;const y=e.map((t=>{const e=Object.assign({},t),i=Number.parseFloat(e[s])/g,n=i*v;return d&&(e[d]=i),o&&(e[o]=m),l&&(e[l]=m+n),h&&(e[h]=m+n/2),c&&(e[c]=n),u&&(e[u]=xV(m+n/2)),p&&(e[p]=Number.parseFloat(e[s])/f),m=e[l],e}));return y[y.length-1][l]=a,y},markPhase:"beforeJoin"},lttbsample:{transform:(t,e)=>{let i=t.size;const n=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=n,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{yfield:s,groupBy:r}=t;if(e.length){const t={};if(r){for(let i=0,n=e.length;i{const s=t[e];if(s.length<=i){const t=s.map((t=>t.i));n=n.concat(t)}else{const t=rW(i,s,!0);n=n.concat(t)}})),n.sort(((t,e)=>t-e)),n.map((t=>e[t]))}return rW(i,e,!1,s).map((t=>e[t]))}return[]},markPhase:"afterEncode"},markoverlap:{transform:(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;l(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:n,delta:s,deltaMul:r=1,groupBy:a}=t,o=t=>{!function(t){t.forEach((t=>{t.setGraphicAttribute("visible",!0)}))}(t);const e=t.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x")));0===n?function(t,e,i,n){if(n){const n=-1/0;let s=-1/0,r=0,a=0;const o=l(e);let h=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,l=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(h=(e+r)*i),a=(n-l)**2+(s-c)**2,a<(h+r+e)**2?t.getGraphicAttribute("forceShow")||t.setGraphicAttribute("visible",!1):s=c,r=e}))}}(e,s,r,i):1===n?function(t,e,i,n){if(n){let n=-1/0,s=0;const r=l(e);let a=e;t.forEach((t=>{const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+s)*i),Math.abs(o-n){const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+s)*i),Math.abs(o-n){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},markPhase:"afterEncode"},identifier:{transform:(t,e,i,n)=>{l(n[aW])&&(n[aW]=0);let s=n[aW];const r=t.as;return e.forEach((t=>{t&&l(t[r])&&(s+=1,t[r]=s)})),n[aW]=s,s},markPhase:"beforeJoin"},dodge:{transform:(t,e)=>{var i,n,s;if(!e||0===e.length||!(null===(i=e[0])||void 0===i?void 0:i.mark))return e;const r=e[0].mark,a=r.getScales(),o=Object.values(a).find(MW);if(!o)return e;const h=r.getScalesByChannel(),c=CW(o),d=l(t.dodgeChannel)?h.y===o||h.y1===o||h.x&&!MW(h.x)||h.x1&&!MW(h.x1)?"y":"x":t.dodgeChannel;if(c>0){const i=null!==(n=t.innerGap)&&void 0!==n?n:0,a=null!==(s=t.categoryGap)&&void 0!==s?s:"20%";let o=t=>t.groupKey;if(!l(t.dodgeBy)){const e=Ro(V(t.dodgeBy));o=t=>e(t.getDatum())}const h=[];e.forEach((t=>{const e=o(t);h.includes(e)||h.push(e)}));const u=h.length;if(u<1)return e;const p=Vo(a,c);let g=p>=c?c:c-p;const f=Vo(i,g);let v=(g-Math.max(u-1,0)*f)/u;v>t.maxWidth?(g-=(v-t.maxWidth)*u,v=t.maxWidth):v{m[t]=-g/2+e*(v+f)}));const y=r.markType;"rect"===y||"interval"===y||"arc"===y?e.forEach((t=>{const e=o(t),i=m[e],n=t.getItemAttribute();if("x"===d){const e={x:(l(n.width)&&!l(n.x1)?Math.min(n.x,n.x1):n.x)+(l(n.width)?l(n.x1)?c:Math.abs(n.x1-n.x):n.width)/2+i};l(n.width)?e.x1=e.x+v:e.width=v,t.setItemAttributes(e)}else if("y"===d){const e={y:(l(n.height)&&!l(n.y1)?Math.min(n.y,n.y1):n.y)+(l(n.height)?l(n.y1)?c:Math.abs(n.y1-n.y):n.height)/2+i};l(n.height)?e.y1=e.y+v:e.height=v,t.setItemAttributes(e)}})):e.forEach((t=>{const e=o(t),i=m[e];if("x"===d){const e=t.getItemAttribute("x")+c/2+i+v/2;t.setItemAttributes({x:e}),"rule"===y&&t.setItemAttributes({x1:e})}else if("y"===d){const e=t.getItemAttribute("y")+c/2+i+v/2;t.setItemAttributes({y:e}),"rule"===y&&t.setItemAttributes({y1:e})}}))}return e},markPhase:"afterEncodeItems"}},EW={},PW=t=>EW[t],RW=(t,e)=>{EW[t]={creator:e}};class OW extends zE{constructor(t){super(t),this.attribute=t,this.onSetStage((()=>{this.render()}))}render(){var t;const e=this.createOrUpdateChild("large-path",{},"path"),i=this.attribute.points,n=null!==(t=e.attribute.path)&&void 0!==t?t:new Dk;let s,r,a,o;n.clear();for(let t=0,e=i.length;t{this.render()}))}render(){var t,e;const i=this.createOrUpdateChild("large-path",{},"path"),n=this.attribute.points,s=null!==(t=this.attribute.size)&&void 0!==t?t:iM.size,r=null!==(e=i.attribute.path)&&void 0!==e?e:new Dk;let a,o;r.clear();const l=y(s)?s:Ot(s[0],s[1]);for(let t=0,e=n.length;t2&&void 0!==arguments[2]?arguments[2]:{};if(t.emit(NV.BEFORE_CREATE_VRENDER_MARK),e===OV.largeRects)return new OW(i);if(e===OV.largeSymbols)return new BW(i);const n=IW[e]?IW[e](i):PW(e)?PW(e).creator(i):null;return t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}function LW(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t.emit(NV.BEFORE_CREATE_VRENDER_MARK);const n=new FR(i),s=e.getMarks(),r=Object.keys(s).map((t=>{const e=IW[s[t]]();return e.name=t,e}));return n.setSubGraphic(r),t.emit(NV.AFTER_CREATE_VRENDER_MARK),n}const FW=t=>{t&&(t[WV]=null,t.release(),t.parent&&t.parent.removeChild(t))};let jW=class{constructor(t){this.data=null,this.states=[],this.diffState=RV.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!a)return{};if(o(a))return a(this.getDatum(),this,t,e);if(!r&&(null===(s=this.graphicItem.states)||void 0===s?void 0:s[t]))return this.graphicItem.states[t];const h=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));AW(this,h,a,this.mark.parameters());const c=this.transformElementItems(h,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=c):this.graphicItem.states={[t]:c},c},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?_W(this.mark.getAttributeTransforms(),t,this):t,this.graphicItem.setAttributes(this.graphicItem.attribute),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes(t),this.setFinalGraphicAttributes(t))}updateGraphicItem(t){var e;if(!this.graphicItem)return;l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),l(t.interactive)||this.graphicItem.setAttribute("pickable",t.interactive),l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),this.diffState===RV.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const i=this.mark.getSpec();(null===(e=i.animation)||void 0===e?void 0:e.state)&&(this.graphicItem.stateAnimateConfig=i.animation.state)}getGraphicItem(){return this.graphicItem}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states.slice()}updateData(t,e,i){var n;this.mark.emit(NV.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const s=TV(i);return this.items=e.map((t=>({datum:t,key:s(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(n=this.items)||void 0===n?void 0:n[0].key,this.mark.emit(NV.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const n=this.mark.isCollectionMark(),s=this.states,r=V(kV(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&a.sort(a);const o=r.length!==s.length||r.some(((t,e)=>t!==s[e]));this.states=r,!n&&o&&this.diffState===RV.unChange&&(this.diffState=RV.update)}encodeGraphic(t){var e,i;this.coordinateTransformEncode(this.items),!l(null==t?void 0:t.enableSegments)&&(null===(i=null===(e=this.items)||void 0===e?void 0:e[0])||void 0===i?void 0:i.nextAttrs)&&(this.items[0].nextAttrs.enableSegments=t.enableSegments);const n=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(n,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,this.applyGraphicAttributes(n)):this.initGraphicItem(n),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||this.useStates(this.states),this.mark.markType===OV.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCutomizedShape()}_setCutomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Dk))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=this.mark.isCollectionMark(),r=e[PV.update],a=e[PV.enter],o=e[PV.exit],l=this.mark.isLargeMode();this.diffState===RV.enter?(a&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.update?((s&&a||i)&&AW(this,t,a,n,l),r&&AW(this,t,r,n,l)):this.diffState===RV.exit&&o&&(i&&AW(this,t,a,n,l),AW(this,t,o,n,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,n=e.convert(i);Object.assign(i,n)}))}clearStates(t){var e;const i=a(t)?t:!!(null===(e=this.mark.getSpec().animation)||void 0===e?void 0:e.state);this.states=[],this.graphicItem&&this.graphicItem.clearStates(i),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&this.states.includes(t)}addState(t,e){var i;const n=V(t).reduce(((t,e)=>(t.includes(e)||t.push(e),t)),this.states.slice()),s=e&&g(t)&&!z(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]);s&&this._updateRuntimeStates(t,e),n.length!==this.states.length?this.useStates(n):s&&this.graphicItem&&(this.graphicItem.clearStates(),this.useStates(n))}removeState(t){const e=V(t),i=this.states.filter((t=>!e.includes(t)));i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i))}useStates(t,e){var i,n;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&this.states.sort(s);const r=a(e)?e:!!(null===(n=this.mark.getSpec().animation)||void 0===n?void 0:n.state);this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,r),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const n in t)No(n,i,t)&&P(i,n)||(e[n]=t[n]);return e}transformElementItems(t,e,i){var n,s,r,a,o;const h=t[0];if(!h.nextAttrs||0===Object.keys(h.nextAttrs).length)return{};let c=null==h?void 0:h.nextAttrs;if(t&&t.length&&l(null===(n=h.nextAttrs)||void 0===n?void 0:n.points)&&(!0===i||fW(Object.keys(h.nextAttrs),this.mark.markType))&&function(t){return[OV.line,OV.area,OV.largeRects,OV.largeSymbols].includes(t)}(e)){const i=this.getGraphicAttribute("points",!1),n=this.getGraphicAttribute("segments",!1),d=null!==(s=h.nextAttrs.enableSegments)&&void 0!==s?s:this.getGraphicAttribute("enableSegments",!1),u=t.map((t=>t.nextAttrs)),p=this.mark.isProgressive();if(c=Object.assign({},c),delete c.x,delete c.y,e===OV.line||e===OV.area){const s=function(t,e,i,n){return!t||!t.length||1===t.length&&e?[]:t.some((t=>fW(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var s,r,a,o,l,h,c,d,u,p;const g=t.nextAttrs,f=gW(null!==(s=g.x)&&void 0!==s?s:null===(r=null==i?void 0:i[e])||void 0===r?void 0:r.x),v=gW(null!==(a=g.y)&&void 0!==a?a:null===(o=null==i?void 0:i[e])||void 0===o?void 0:o.y),m=null!==(l=g.defined)&&void 0!==l?l:null===(h=null==i?void 0:i[e])||void 0===h?void 0:h.defined,y={x:f,y:v,context:t.key};if(n){const t=gW(null!==(c=g.x1)&&void 0!==c?c:null===(d=null==i?void 0:i[e])||void 0===d?void 0:d.x1),n=gW(null!==(u=g.y1)&&void 0!==u?u:null===(p=null==i?void 0:i[e])||void 0===p?void 0:p.y1);y.x1=t,y.y1=n}return!1===m&&(y.defined=!1),y})):null!=i?i:[]}(t,!0,i,e===OV.area);if(d&&!p){const t=s&&0!==s.length?s:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(n),e=function(t,e,i){var n;if(!t||t.length<=1)return null;const s="area"===(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.markType)?SW:xW,r=[];let a=null;return t.forEach(((t,e)=>{a&&s.every((e=>bW(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const n=_W(OV.line,t.attrs,i);return n.points=e.slice(t.startIndex,l(t.endIndex)?e.length:t.endIndex),n})):null}(u,t,this);e?(c.segments=e,c.points=null):(c.segments=null,c.points=t)}else p?c.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:s}]):(c.points=s,c.segments=null)}else e===OV.largeRects?c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var s,r,a,o;const l=t.nextAttrs,h=gW(null!==(s=l.x)&&void 0!==s?s:null==i?void 0:i[4*e]),c=gW(null!==(r=l.y)&&void 0!==r?r:null==i?void 0:i[4*e+1]),d=gW(null!==(a=l.width)&&void 0!==a?a:null==i?void 0:i[4*e+2]),u=gW(null!==(o=l.y1)&&void 0!==o?o:null==i?void 0:i[4*e+3]);n[4*e]=h,n[4*e+1]=c,n[4*e+2]=d,n[4*e+3]=u-c})),n}(t,!0,i):e===OV.largeSymbols&&(c.points=function(t,e,i){if(!t||!t.length||1===t.length&&e)return[];const n=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var s,r;const a=t.nextAttrs,o=gW(null!==(s=a.x)&&void 0!==s?s:null==i?void 0:i[2*e]),l=gW(null!==(r=a.y)&&void 0!==r?r:null==i?void 0:i[2*e+1]);n[2*e]=o,n[2*e+1]=l})),n}(t,!0,i))}return c}applyGraphicAttributes(t){if(!C(t))if(this.mark.needAnimate()){const e=this.diffAttributes(t),i=this.getPrevGraphicAttributes(),n=this.getFinalGraphicAttributes();Object.keys(e).forEach((t=>{i[t]=this.getGraphicAttribute(t),n[t]=e[t]})),this.setNextGraphicAttributes(e),this.setPrevGraphicAttributes(i),this.setFinalGraphicAttributes(n),this.graphicItem.setAttributes(n)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!l(e=T(i,t)))return e}const n=this.mark.getAttributeTransforms();let s=[t];if(n&&n.length){const e=n.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(s=[e.storedAttrs,t])}return T(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,s)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const n=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();i&&n&&(n[t]=e),s&&!P(s,t)&&(s[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();Object.keys(t).forEach((s=>{i&&e&&(i[s]=t[s]),n&&!P(n,s)&&(n[s]=this.graphicItem.attribute[s])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}clearChangedGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}))}clearGraphicAttributes(){this.graphicItem&&(this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}))}remove(){this.graphicItem&&(FW(this.graphicItem),this.graphicItem=null)}release(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.mark=null,this.data=null,this.graphicItem&&(FW(this.graphicItem),this.graphicItem[WV]=null,this.graphicItem=null),this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?l(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):l(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?f(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};const zW=(t,e,i)=>{const n=t.getGraphicAttribute("points",!1),s={x:0,y:0};return n.forEach((t=>{s.x+=t.x,s.y+=t.y})),s.x/=n.length,s.y/=n.length,(null==e?void 0:e.center)&&(_(e.center.x)&&(s.x=e.center.x),_(e.center.y)&&(s.y=e.center.y)),n.map((()=>Object.assign(s)))},HW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().width():i.width;return{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined}}return{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined}})),NW=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{if("negative"===(null==e?void 0:e.orient)){const e=i.group?i.group.getBounds().height():i.height;return{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined}}return{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined}}));const VW=["visible","path","text","lineWidth","textBaseline","textAlign"],WW={clipIn:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(n=t.getGraphicAttribute("clipRange",!1))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:s}}:{from:{clipRange:0},to:{clipRange:r}}},clipOut:(t,e,i)=>{var n;const s=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(n=t.getGraphicAttribute("clipRange",!0))&&void 0!==n?n:1;return(null==e?void 0:e.clipDimension)?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:s}}:{from:{clipRange:r},to:{clipRange:0}}},fadeIn:(t,e,i)=>{var n,s,r;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(n=t.getGraphicAttribute("opacity",!1))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!1))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!1))&&void 0!==r?r:1}}},fadeOut:(t,e,i)=>{var n,s,r;return{from:{opacity:null!==(n=t.getGraphicAttribute("opacity",!0))&&void 0!==n?n:1,fillOpacity:null!==(s=t.getGraphicAttribute("fillOpacity",!0))&&void 0!==s?s:1,strokeOpacity:null!==(r=t.getGraphicAttribute("strokeOpacity",!0))&&void 0!==r?r:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}},moveIn:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:g},to:{x:t.getGraphicAttribute("x",!1)}};case"y":return{from:{y:f},to:{y:t.getGraphicAttribute("y",!1)}};default:return{from:{x:g,y:f},to:{x:t.getGraphicAttribute("x",!1),y:t.getGraphicAttribute("y",!1)}}}},moveOut:(t,e,i)=>{var n,s,r,a,o;const l=null!==(n=null==e?void 0:e.offset)&&void 0!==n?n:0,h=i.group?i.group.getBounds():null,c=null!==(s=null==h?void 0:h.width())&&void 0!==s?s:i.width,d=null!==(r=null==h?void 0:h.height())&&void 0!==r?r:i.height,u=("negative"===(null==e?void 0:e.orient)?c:0)+l,p=("negative"===(null==e?void 0:e.orient)?d:0)+l,g=_(null===(a=null==e?void 0:e.point)||void 0===a?void 0:a.x)?e.point.x:u,f=_(null===(o=null==e?void 0:e.point)||void 0===o?void 0:o.y)?e.point.y:p;switch(null==e?void 0:e.direction){case"x":return{from:{x:t.getGraphicAttribute("x",!0)},to:{x:g}};case"y":return{from:{y:t.getGraphicAttribute("y",!0)},to:{y:f}};default:return{from:{x:t.getGraphicAttribute("x",!0),y:t.getGraphicAttribute("y",!0)},to:{x:g,y:f}}}},scaleIn:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:0},to:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!1))&&void 0!==n?n:1}};case"y":return{from:{scaleY:0},to:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!1))&&void 0!==s?s:1}};default:return{from:{scaleX:0,scaleY:0},to:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!1))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!1))&&void 0!==a?a:1}}}},scaleOut:(t,e,i)=>{var n,s,r,a;switch(null==e?void 0:e.direction){case"x":return{from:{scaleX:null!==(n=t.getGraphicAttribute("scaleX",!0))&&void 0!==n?n:1},to:{scaleX:0}};case"y":return{from:{scaleY:null!==(s=t.getGraphicAttribute("scaleY",!0))&&void 0!==s?s:1},to:{scaleY:0}};default:return{from:{scaleX:null!==(r=t.getGraphicAttribute("scaleX",!0))&&void 0!==r?r:1,scaleY:null!==(a=t.getGraphicAttribute("scaleY",!0))&&void 0!==a?a:1},to:{scaleX:0,scaleY:0}}}},rotateIn:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!1))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r},to:{angle:s}}},rotateOut:(t,e,i)=>{var n;const s=null!==(n=t.getGraphicAttribute("angle",!0))&&void 0!==n?n:0;let r=0;return r=at(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:_(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:r}}},growCenterIn:(t,e,i)=>{const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("y",!1),a=t.getGraphicAttribute("y1",!1),o=t.getGraphicAttribute("width",!1),h=t.getGraphicAttribute("height",!1),c=t.getGraphicItem().attribute.x,d=t.getGraphicItem().attribute.y,u=t.getGraphicItem().attribute.width,p=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{from:{x:c+u/2,x1:l(s)?void 0:c+u/2,width:l(o)?void 0:0},to:{x:n,x1:s,width:o}};case"y":return{from:{y:d+p/2,y1:l(a)?void 0:d+p/2,height:l(h)?void 0:0},to:{y:r,y1:a,height:h}};default:return{from:{x:c+u/2,y:d+p/2,x1:l(s)?void 0:c+u/2,y1:l(a)?void 0:d+p/2,width:l(o)?void 0:0,height:l(h)?void 0:0},to:{x:n,y:r,x1:s,y1:a,width:o,height:h}}}},growCenterOut:(t,e,i)=>{const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicAttribute("height",!1),o=t.getGraphicItem().attribute.x,h=t.getGraphicItem().attribute.width,c=t.getGraphicItem().attribute.y,d=t.getGraphicItem().attribute.height;switch(null==e?void 0:e.direction){case"x":return{to:{x:o+h/2,x1:l(n)?void 0:o+h/2,width:l(r)?void 0:0}};case"y":return{to:{y:c+d/2,y1:l(s)?void 0:c+d/2,height:l(a)?void 0:0}};default:return{to:{x:o+h/2,y:c+d/2,x1:l(n)?void 0:o+h/2,y1:l(s)?void 0:c+d/2,width:l(r)?void 0:0,height:l(a)?void 0:0}}}},growWidthIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1),r=t.getGraphicAttribute("width",!1),a=t.getGraphicItem().attribute.x,o=a+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{from:{x:o,x1:l(s)?void 0:o,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}:{from:{x:a,x1:l(s)?void 0:a,width:l(r)?void 0:0},to:{x:n,x1:s,width:r}}}(t,e)},growWidthOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("width",!1),r=t.getGraphicItem().attribute.x,a=r+t.getGraphicItem().attribute.width;return"negative"===(null==e?void 0:e.orient)?{to:{x:a,x1:l(n)?void 0:a,width:l(s)?void 0:0}}:{to:{x:r,x1:l(n)?void 0:r,width:l(s)?void 0:0}}}(t,e)},growHeightIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1);let a;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else a=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("height",!1),a=t.getGraphicItem().attribute.y,o=a+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{from:{y:o,y1:l(s)?void 0:o,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}:{from:{y:a,y1:l(s)?void 0:a,height:l(r)?void 0:0},to:{y:n,y1:s,height:r}}}(t,e)},growHeightOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e,i):function(t,e,i){const n=t.getGraphicAttribute("y1",!1),s=t.getGraphicAttribute("height",!1),r=t.getGraphicItem().attribute.y,a=r+t.getGraphicItem().attribute.height;return"negative"===(null==e?void 0:e.orient)?{to:{y:a,y1:l(n)?void 0:a,height:l(s)?void 0:0}}:{to:{y:r,y1:l(n)?void 0:r,height:l(s)?void 0:0}}}(t,e)},growAngleIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:i,endAngle:i},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:t.getGraphicAttribute("startAngle",!1),endAngle:t.getGraphicAttribute("endAngle",!1)}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("endAngle",!1)},to:{startAngle:t.getGraphicAttribute("startAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("startAngle",!1)},to:{endAngle:t.getGraphicAttribute("endAngle",!1)}})(t,e)},growAngleOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{if("anticlockwise"===(null==e?void 0:e.orient)){const i=y(null==e?void 0:e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:n,endAngle:n}}})(t,e):((t,e,i)=>"anticlockwise"===(null==e?void 0:e.orient)?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:t.getGraphicAttribute("endAngle",!1)}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:t.getGraphicAttribute("startAngle",!1)}})(t,e)},growRadiusIn:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1),outerRadius:t.getGraphicAttribute("outerRadius",!1)}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("outerRadius",!1)},to:{innerRadius:t.getGraphicAttribute("innerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("innerRadius",!1)},to:{outerRadius:t.getGraphicAttribute("outerRadius",!1)}})(t,e)},growRadiusOut:(t,e,i)=>{var n;return!1!==(null!==(n=null==e?void 0:e.overall)&&void 0!==n&&n)?((t,e,i)=>{const n=y(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:n,outerRadius:n}}})(t,e):((t,e,i)=>"inside"===(null==e?void 0:e.orient)?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:t.getGraphicAttribute("outerRadius",!1)}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:t.getGraphicAttribute("innerRadius",!1)}})(t,e)},growPointsIn:(t,e,i)=>({from:{points:zW(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:zW(t,e)}}),growPointsXIn:(t,e,i)=>({from:{points:HW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsXOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HW(t,e,i)}}),growPointsYIn:(t,e,i)=>({from:{points:NW(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),growPointsYOut:(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:NW(t,e,i)}}),growIntervalIn:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===(null==e?void 0:e.direction)){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{x:n,x1:n},to:{x:i,x1:n}}:{from:{x:i,x1:i},to:{x:i,y1:n}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);return"negative"===(null==e?void 0:e.orient)?{from:{y:s,y1:s},to:{y:n,y1:s}}:{from:{y:n,y1:n},to:{y:n,y1:s}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!1),s=t.getGraphicAttribute("x1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.width;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:r,x1:r},to:{x:n,y1:s}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:r,y1:r},to:{y:n,y1:s}}}(t,l,i)},growIntervalOut:(t,e,i)=>{var n,s;const r=null===(s=null===(n=t.mark)||void 0===n?void 0:n.coord)||void 0===s?void 0:s.output(),a=r.isTransposed(),o="polar"===r.type,l={orient:"negative",direction:a&&!o?"x":"y"};return!0!==(null==e?void 0:e.overall)?function(t,e,i){if("x"===e.direction){const i=t.getGraphicAttribute("x",!1),n=t.getGraphicAttribute("x1",!1),s=t.getGraphicAttribute("x",!0),r=t.getGraphicAttribute("x1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{x:s,x1:r},to:{x:n,x1:n}}:{from:{x:s,x1:r},to:{x:i,x1:i}}}const n=t.getGraphicAttribute("y",!1),s=t.getGraphicAttribute("y1",!1),r=t.getGraphicAttribute("y",!0),a=t.getGraphicAttribute("y1",!0);return"negative"===(null==e?void 0:e.orient)?{from:{y:r,y1:a},to:{y:s,y1:s}}:{from:{y:r,y1:a},to:{y:n,y1:n}}}(t,l):function(t,e,i){if("x"===(null==e?void 0:e.direction)){const n=t.getGraphicAttribute("x",!0),s=t.getGraphicAttribute("x1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().width():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{x:n,x1:s},to:{x:r,x1:r}}}const n=t.getGraphicAttribute("y",!0),s=t.getGraphicAttribute("y1",!0);let r;if("negative"===(null==e?void 0:e.orient)){const t=i.group?i.group.getBounds().height():i.height;r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:t}else r=y(null==e?void 0:e.overall)?null==e?void 0:e.overall:0;return{from:{y:n,y1:s},to:{y:r,y1:r}}}(t,l,i)},update:(t,e,i)=>{const n=Object.assign({},t.getPrevGraphicAttributes()),s=Object.assign({},t.getNextGraphicAttributes());return VW.forEach((t=>{delete n[t],delete s[t]})),V(null==e?void 0:e.excludeChannels).forEach((t=>{delete n[t],delete s[t]})),Object.keys(s).forEach((t=>{No(t,n,s)&&(delete n[t],delete s[t])})),{from:n,to:s}}},GW=Object.assign({},WW),UW=t=>GW[t],YW=(t,e)=>{GW[t]=e},XW=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),f=e.getGraphicAttribute("median",!1),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.from.min=l,v.to.min=d),_(u)&&(v.from.max=l,v.to.max=u),_(p)&&(v.from.q1=l,v.to.q1=p),_(g)&&(v.from.q3=l,v.to.q3=g),_(f)&&(v.from.median=l,v.to.median=f),v},$W=t=>(e,i,n)=>{var s,r,a;const o=null!==(a=null!==(s=e.getGraphicAttribute("direction",!1))&&void 0!==s?s:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!_(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),f=e.getGraphicAttribute("median",!0),v={from:{x:h,y:c},to:{x:h,y:c}};return _(d)&&(v.to.min=l,v.from.min=d),_(u)&&(v.to.max=l,v.from.max=u),_(p)&&(v.to.q1=l,v.from.q1=p),_(g)&&(v.to.q3=l,v.from.q3=g),_(f)&&(v.to.median=l,v.from.median=f),v},KW=(t,e,i)=>{var n,s,r,a,o,l,h,c,d,u,p,g;if(_(null==i?void 0:i.center))return i.center;let f,v,m,y,b;if("horizontal"===e){f=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x,v=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,m=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");y=i,b=i+e}else{f=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,v=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,m=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");y=i,b=i+e}return _(f)?f:_(y)&&_(b)?(y+b)/2:_(v)&&_(m)?(v+m)/2:_(m)?m:_(v)?v:NaN},qW=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),m=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),y=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),b=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),x=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(y)?(Object.assign(u.box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2})):(Object.assign(u.box,{y:g-v/2,y1:g+v/2}),Object.assign(u.median,{y:g-v/2,y1:g+v/2})),_(x)?(Object.assign(u.max,{y:g-x/2,y1:g+x/2}),Object.assign(u.min,{y:g-x/2,y1:g+x/2})):(Object.assign(u.max,{y:g-v/2,y1:g+v/2}),Object.assign(u.min,{y:g-v/2,y1:g+v/2}))):(_(m)?(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2})),_(b)?(Object.assign(u.max,{x:p-b/2,x1:p+b/2}),Object.assign(u.min,{x:p-b/2,x1:p+b/2})):(Object.assign(u.max,{x:p-f/2,x1:p+f/2}),Object.assign(u.min,{x:p-f/2,x1:p+f/2}))),u},ZW=XW(KW),JW=$W(KW);const QW=(t,e,i)=>{var n,s,r,a;if(_(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if("horizontal"===e){o=null===(s=null===(n=t.getGraphicAttribute("points",!1,"median"))||void 0===n?void 0:n[0])||void 0===s?void 0:s.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const n=t.getGraphicAttribute("height",!1,"q1q3Box"),s=t.getGraphicAttribute("y",!1,"q1q3Box");c=s,d=s+n}return _(o)?o:_(c)&&_(d)?(c+d)/2:_(l)&&_(h)?(l+h)/2:_(h)?h:_(l)?l:NaN},tG=(t,e,i,n)=>{var s,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(s=t.x)&&void 0!==s?s:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),f=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),v=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),m=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),y=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),b=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),x=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return"horizontal"===(null==n?void 0:n.direction)?(_(b)?Object.assign(u.minMaxBox,{y:g-b/2,y1:g+b/2}):Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}),_(x)?(Object.assign(u.q1q3Box,{y:g-x/2,y1:g+x/2}),Object.assign(u.median,{y:g-x/2,y1:g+x/2})):(Object.assign(u.q1q3Box,{y:g-y/2,y1:g+y/2}),Object.assign(u.median,{y:g-y/2,y1:g+y/2}))):(_(v)?Object.assign(u.minMaxBox,{x:p-v/2,x1:p+v/2}):Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}),_(m)?(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})):(Object.assign(u.q1q3Box,{x:p-f/2,x1:p+f/2}),Object.assign(u.median,{x:p-f/2,x1:p+f/2}))),u},eG=XW(QW),iG=$W(QW);const nG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.y1-s/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-s),l=d(t.y1+t.thickness/2-s)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${a},${d(l-s/2)}L${d(a+s)},${d((l+p)/2)}L${a},${d(p+s/2)}`:"",v=t.startArrow&&g?`L${r},${d(u+s/2)}L${d(r-s)},${d((o+u)/2)}L${r},${d(o-s/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${f}L${a},${p}L${r},${u}${v}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}${v}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${v}Z`},sG=(t,e)=>{var i;const n=null!==(i=t.curvature)&&void 0!==i?i:.5,s="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+n*(a-r),c=a+n*(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-s/2),l=d(t.x1-s/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-s),l=d(t.x1+t.thickness/2-s)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+s),p=d(l+s),g=Math.abs(a-r)>1e-6,f=t.endArrow&&g?`L${d(l-s/2)},${a}L${d((l+p)/2)},${d(a+s)}L${d(p+s/2)},${a}`:"",v=t.startArrow&&g?`L${d(u+s/2)},${r}L${d((u+o)/2)},${d(r-s)}L${d(o-s/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${f}L${p},${a}L${u},${r}${v}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}${v}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${v}Z`},rG=(t,e,i,n)=>{var s;const r=null!==(s=t.direction)&&void 0!==s?s:null==n?void 0:n.direction,a=["vertical","TB","BT"].includes(r)?sG:nG,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},aG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign({},n,{x1:n.x0,y1:n.y0}),to:n}},oG=(t,e,i)=>{const n={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:n,to:Object.assign({},n,{x1:n.x0,y1:n.y0})}},lG=(t,e,i)=>{const n={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(n).forEach((t=>{l(n[t])&&delete n[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},n),n),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},n)}},hG=(t,e)=>{if(!t)return null;if(null==t?void 0:t.from){const i=t.from;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.from=e.transformElementItems(s,e.mark.markType,n)}}if(null==t?void 0:t.to){const i=t.to;Object.keys(i).forEach((t=>{l(i[t])&&delete i[t]}));const n=fW(Object.keys(i),e.mark.markType)&&!h(i.segments);if(n){const s=e.items.map((t=>Object.assign({},t,{nextAttrs:i})));t.to=e.transformElementItems(s,e.mark.markType,n)}}return t};const cG=(t,e,i,n,s)=>o(i)?i(t.getDatum(),t,s):i;class dG extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s),this._interpolator=null==s?void 0:s.interpolator,this._element=null==s?void 0:s.element}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}getEndProps(){return this.to}onUpdate(t,e,i){this._interpolator&&this._element&&this._interpolator.call(this,e,this.from,this.to,i,this._element.getDatum(),this._element,this.params.parameters)}}class uG extends HC{getEndProps(){return this.to}onBind(){var t,e;this.from=null!==(t=this.from)&&void 0!==t?t:{},this.to=null!==(e=this.to)&&void 0!==e?e:{}}onStart(){const t=Object.assign({},this.from),e=Object.assign({},this.to);Object.keys(e).forEach((e=>{l(t[e])&&(t[e]=this.target.getComputedAttribute(e))})),this.target.setAttributes(t,!1,{type:$A.ANIMATE_UPDATE,animationState:{ratio:0,end:!1}}),this._fromAttribute=t,this._toAttribute=e}onEnd(){this.target.setAttributes(this._toAttribute,!1,{type:$A.ANIMATE_END})}onUpdate(t,e,i){this.target.stepInterpolate(this.subAnimate,this.subAnimate.animate,i,this.step,e,t,this._toAttribute,this._fromAttribute)}}VC.mode|=qA.SET_ATTR_IMMEDIATELY;let pG=0;const gG=t=>!l(t)&&t.prototype instanceof HC;class fG{constructor(t,e,i){this.id=pG++,this.isAnimating=!1,this.runnings=[],this.element=t,this.animationOptions=i,this.unit=e}callback(t){return this.callbackFunction=t,this}animate(t,e){return this.isAnimating=!0,this.animateElement(t,e),0===this.runnings.length&&this.animationEnd(),this}stop(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end",e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.runnings.forEach((e=>e.stop(t))),this.animationEnd(e),this}pause(){return this.runnings.forEach((t=>t.pause())),this}resume(){return this.runnings.forEach((t=>t.resume())),this}startAt(t){return this.runnings.forEach((e=>{const i=this.unit.initialDelay;e.startAt(i+t)})),this}getTotalAnimationTime(){var t;const e=this.unit.initialDelay+this.unit.loopDuration*this.unit.loopCount;return null!==(t=this.unit.totalTime)&&void 0!==t?t:e}animationEnd(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var e;this.isAnimating=!1,this.runnings=null,t&&(null===(e=this.callbackFunction)||void 0===e||e.call(null))}animateElement(t,e){const i=this.element.getGraphicItem().animate();this.runnings.push(i),i.startAt(this.unit.initialDelay),i.wait(this.unit.loopDelay),this.unit.timeSlices.forEach((n=>{this.animateTimeSlice(i,n,t,e)})),i.wait(this.unit.loopDelayAfter),i.loop(this.unit.loopCount-1),_(this.unit.totalTime)&&setTimeout((()=>{i&&i.stop("end")}),this.unit.totalTime),i.onEnd((()=>{this.runnings=this.runnings.filter((t=>t!==i)),0===this.runnings.length&&this.animationEnd()}))}animateTimeSlice(t,e,i,n){const s=e.delay,r=e.duration,a=e.effects;if(s>0&&t.wait(s),a.length<0)t.wait(r);else{const e=a.map(((t,e)=>{var s;const a=null!==(s=t.type?function(t,e,i,n){const s=o(e.options)?e.options.call(null,t.getDatum(),t,n):e.options;if(!e.type||!UW(e.type))return null;const r=UW(e.type)(t,s,i);return hG(r,t)}(this.element,t,i,n):function(t,e,i,n){const s=e.channel;let r=null;return f(s)?r=s.reduce(((e,i)=>(e.from[i]=t.getGraphicAttribute(i,!0),e.to[i]=t.getGraphicAttribute(i,!1),e)),{from:{},to:{}}):c(s)&&(r=Object.keys(s).reduce(((e,i)=>{var r,a;const o=!l(null===(r=s[i])||void 0===r?void 0:r.from),h=!l(null===(a=s[i])||void 0===a?void 0:a.to);return(o||h)&&(e.from[i]=o?cG(t,0,s[i].from,0,n):void 0,e.to[i]=h?cG(t,0,s[i].to,0,n):t.getGraphicAttribute(i,!1)),e}),{from:{},to:{}})),hG(r,t)}(this.element,t,0,n))&&void 0!==s?s:{},h=(null==a?void 0:a.custom)||(null==t?void 0:t.custom),d=(null==a?void 0:a.customParameters)||(null==t?void 0:t.customParameters);a.from&&Object.keys(a.from).length&&this.unit&&this.animationOptions.timeline.controlOptions.immediatelyApply&&"component"!==this.element.mark.markType&&this.element.getGraphicItem().setAttributes(a.from);const u=gG(h);return l(h)||gG(h)?u?new h(a.from,a.to,r,t.easing,d):a.to?new uG(a.from,a.to,r,t.easing):void 0:new dG(a.from,a.to,r,t.easing,{interpolator:h,element:this.element,parameters:d})})).filter((t=>!l(t)));1===e.length?t.play(e[0]):t.play(new vT(r,e))}}}function vG(t){let e=[];return Object.keys(t).forEach((i=>{e=e.concat(mG(i,t[i]))})),e}function mG(t,e){const i=[];let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return V(e).forEach((e=>{var s;const r=function(t){var e,i,n,s,r,a,o,h,c,d,u;if(l(t.timeSlices)){const l=t;return{startTime:null!==(e=l.startTime)&&void 0!==e?e:qV,totalTime:l.totalTime,oneByOne:null!==(i=l.oneByOne)&&void 0!==i?i:tW,loop:null!==(n=l.loop)&&void 0!==n?n:QV,controlOptions:D({},iW,null!==(s=l.controlOptions)&&void 0!==s?s:{}),timeSlices:[{duration:null!==(r=l.duration)&&void 0!==r?r:ZV,delay:null!==(a=l.delay)&&void 0!==a?a:JV,effects:[{type:l.type,channel:l.channel,custom:l.custom,easing:null!==(o=l.easing)&&void 0!==o?o:eW,customParameters:l.customParameters,options:l.options}]}]}}const p=V(t.timeSlices).filter((t=>t.effects&&V(t.effects).filter((t=>t.channel||t.type)).length));if(p.length)return{startTime:null!==(h=t.startTime)&&void 0!==h?h:qV,totalTime:t.totalTime,oneByOne:null!==(c=t.oneByOne)&&void 0!==c?c:tW,loop:null!==(d=t.loop)&&void 0!==d?d:QV,controlOptions:D({},iW,null!==(u=t.controlOptions)&&void 0!==u?u:{}),timeSlices:p.map((t=>{var e;return{duration:t.duration,delay:null!==(e=t.delay)&&void 0!==e?e:JV,effects:V(t.effects).filter((t=>t.channel||t.type)).map((t=>{var e;return{type:t.type,channel:t.channel,custom:t.custom,easing:null!==(e=t.easing)&&void 0!==e?e:eW,customParameters:t.customParameters,options:t.options}}))}})),partitioner:t.partitioner,sort:t.sort}}(e);r&&(i.push({state:t,id:null!==(s=r.id)&&void 0!==s?s:`${t}-${n}`,timeline:r,originConfig:e}),n+=1)})),i}function yG(t,e,i){return o(t)?t.call(null,e.getDatum(),e,i):t}class _G{constructor(t){this.parallelArrangers=[this],this.totalTime=0,this.startTime=0,this.endTime=0,this.animators=t.filter((t=>!l(t))),this.totalTime=this.animators.reduce(((t,e)=>Math.max(t,e.getTotalAnimationTime())),0)}parallel(t){const e=Array.from(new Set(this.parallelArrangers.concat(t.parallelArrangers)));return e.forEach((t=>{t.parallelArrangers=e})),this.arrangeTime(),this}after(t){return this.afterArranger=t,this.arrangeTime(),this}arrangeTime(){const t=this.parallelArrangers.reduce(((t,e)=>Math.max(t,e.totalTime)),this.totalTime),e=this.parallelArrangers.reduce(((t,e)=>{var i,n;return Math.max(t,null!==(n=null===(i=e.afterArranger)||void 0===i?void 0:i.endTime)&&void 0!==n?n:0)}),0);this.parallelArrangers.forEach((i=>{i.startTime=e,i.endTime=e+t,i.animators.forEach((t=>{t.startAt(e)}))}))}}class bG{constructor(t,e){this.state=null,this.immediateConfigs=[],this.isEnabled=!0,this.disabledStates=[],this.animators=new Map,this.elementRecorder=new WeakMap,this.timelineCount={},this.mark=t,this.configs=vG(null!=e?e:{})}updateConfig(t){this.configs=vG(null!=t?t:{})}updateState(t){this.state=t}animate(){if(!this.isEnabled||!this.configs||!this.configs.length)return;const t=this.mark.getAllElements(),e=this.mark.parameters();return t.forEach((t=>{var e;t.isReserved&&t.diffState!==RV.exit&&(t.isReserved=!1);const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.prevState;this.configs.some((e=>i!==t.diffState&&e.state===i&&e.timeline.controlOptions.stopWhenStateChange))&&this.clearElementAnimation(t,!1)})),this.configs.forEach((i=>{this.animateByTimeline(i,t,e)})),this.mark.cleanExitElements(),this}runAnimationByState(t){if(!this.isEnabled)return;const e=this.configs.filter((e=>e.state===t)),i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stopAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.stop())),this}pauseAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.pause())),this}resumeAnimationByState(t){const e=this.animators.get(t);return e&&e.forEach((t=>t.resume())),this}run(t){if(!this.isEnabled)return;const e=mG(KV,t,this.immediateConfigs.length);this.immediateConfigs=this.immediateConfigs.concat(e);const i=this.mark.getAllElements(),n=this.mark.parameters(),s=e.reduce(((t,e)=>t.concat(this.animateByTimeline(e,i,n,!0))),[]);return new _G(s)}stop(){return this.animators.forEach((t=>{t.forEach((t=>t.stop()))})),this}pause(){return this.animators.forEach((t=>t.forEach((t=>t.pause())))),this}resume(){return this.animators.forEach((t=>t.forEach((t=>t.resume())))),this}reverse(){return this}restart(){return this}record(){return this}recordEnd(){return this}isAnimating(){let t=!1;return this.animators.forEach((e=>{t=t||e.some((t=>t.isAnimating))})),t}isElementAnimating(t){var e;const i=null===(e=this.elementRecorder.get(t))||void 0===e?void 0:e.count;return l(i)||Object.values(i).every((t=>0===t))}getAnimatorCount(){let t=0;return this.animators.forEach((e=>t+=e.length)),t}getAllAnimators(){const t=[];return this.animators.forEach((e=>{t.push(...e)})),t}getElementAnimators(t,e){var i;const n=V(t);let s=[];return e?s=null!==(i=this.animators.get(e))&&void 0!==i?i:[]:this.animators.forEach((t=>{s=s.concat(t)})),s.filter((t=>n.includes(t.element)))}enable(){return this.isEnabled=!0,this}disable(){return this.isEnabled=!1,this.stop(),this.animators.clear(),this}enableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.filter((t=>!e.includes(t))),this}disableAnimationState(t){const e=V(t);return this.disabledStates=this.disabledStates.concat(e),this}release(){this.stop(),this.animators.clear(),this.configs=null,this.animators=null,this.elementRecorder=null,this.timelineCount=null}animateByTimeline(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=[],r=e.filter((e=>{const s=!(e.isReserved&&e.diffState===RV.exit),r=this.getAnimationState(e),a=!this.disabledStates.includes(r),o=n||r===t.state,l=!t.timeline.partitioner||t.timeline.partitioner(e.getDatum(),e,i);return s&&a&&o&&l}));return r.length&&(l(this.timelineCount[t.id])&&(this.timelineCount[t.id]=0),t.timeline.sort&&r.sort(((e,n)=>t.timeline.sort(e.getDatum(),n.getDatum(),e,n,i))),r.forEach(((e,n)=>{var a;const o={width:this.mark.view.width(),height:this.mark.view.height(),group:null!==(a=this.mark.group)&&void 0!==a?a:null,mark:this.mark,view:this.mark.view,elementCount:r.length,elementIndex:n},l=Object.assign({VGRAMMAR_ANIMATION_PARAMETERS:o},i),h=this.getAnimationUnit(t.timeline,e,n,r.length,l);s.push(this.animateElement(t,h,e,o,l))}))),s}animateElement(t,e,i,n,s){var r,a,o;const l=new fG(i,e,t);if(l.animate(n,s),!l.isAnimating)return;i.diffState===RV.exit&&(i.isReserved=!0);const h=0===this.timelineCount[t.id];this.timelineCount[t.id]+=1;const c=null!==(r=this.elementRecorder.get(i))&&void 0!==r?r:{prevState:t.state,count:{}};c.prevState=t.state,c.count[t.state]=(null!==(a=c.count[t.state])&&void 0!==a?a:0)+1,this.elementRecorder.set(i,c),this.animators.set(t.state,(null!==(o=this.animators.get(t.state))&&void 0!==o?o:[]).concat(l)),l.callback((()=>{this.handleAnimatorEnd(l)}));const d={mark:this.mark,animationState:t.state,animationConfig:t.originConfig};return h&&this.mark.emit(NV.ANIMATION_START,d),this.mark.emit(NV.ELEMENT_ANIMATION_START,d,i),l}getAnimationState(t){const e=kV(this.state,this.mark.parameters(),t.getDatum(),t);return null!=e?e:t.diffState}getAnimationUnit(t,e,i,n,s){const r=[],a=yG(t.startTime,e,s),o=yG(t.totalTime,e,s),l=yG(t.oneByOne,e,s),h=yG(t.loop,e,s);let c=0;t.timeSlices.forEach((t=>{var i;const a=yG(t.delay,e,s),l=null!==(i=yG(t.duration,e,s))&&void 0!==i?i:o/n,h=V(t.effects).map((t=>Object.assign({},t,{customParameters:yG(t.customParameters,e,s)})));r.push({effects:h,duration:l,delay:a}),c+=a+l}));const d=y(l)?l:!0===l?c:0;return{initialDelay:a,loopCount:y(h)?h:!0===h?1/0:1,loopDelay:d*i,loopDelayAfter:d*(n-i-1),loopAnimateDuration:c,loopDuration:c+d*(n-1),totalTime:o,timeSlices:r}}clearElementAnimation(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.animators.forEach((i=>{i.forEach((i=>{i.element===t&&(i.animationOptions.state===RV.exit?i.stop("start",!1):i.stop("end",!1),this.handleAnimatorEnd(i,e))}))})),this.elementRecorder.delete(t)}clearAllElements(){const t=this.mark.getAllElements();t&&t.forEach(((e,i)=>{this.clearElement(e,i===t.length-1)}))}clearElement(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.clearElementAnimation(t),t.getGraphicItem()&&(t.clearGraphicAttributes(),t.diffState===RV.exit&&(t.isReserved=!1),e&&this.mark.cleanExitElements())}handleAnimatorEnd(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t.element,n=t.animationOptions,s=n.state,r=s===KV,a=this.elementRecorder.get(i).count;a[s]-=1,this.animators.set(s,this.animators.get(s).filter((e=>e!==t))),0===this.animators.get(s).length&&this.animators.delete(s),this.timelineCount[n.id]-=1;const o=0===this.timelineCount[n.id],l=r?this.immediateConfigs.find((t=>t.id===n.id)).originConfig:this.configs.find((t=>t.id===n.id)).originConfig;o&&(delete this.timelineCount[n.id],r&&(this.immediateConfigs=this.immediateConfigs.filter((t=>t.id!==n.id)))),e&&(0===Object.keys(this.timelineCount).length?this.clearAllElements():s===RV.exit&&0===a[RV.exit]&&this.clearElement(i));const h={mark:this.mark,animationState:s,animationConfig:l};o&&this.mark.emit(NV.ANIMATION_END,h),this.mark.emit(NV.ELEMENT_ANIMATION_END,h,i)}}const xG=(t,e)=>CV(t)?t.output():t&&c(t)?o(t.callback)?i=>t.callback(i,e):o(t.value)?t.value(e):t:t,SG=(t,e)=>t?c(t)?Object.keys(t).reduce(((i,n)=>{const s=t[n];return i[n]=xG(s,e),i}),{}):t.map((t=>xG(t,e))):t;var wG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};let AG=-1;class kG extends s{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++AG}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=V(this.spec.dependency).map((t=>g(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=V(t).map((t=>g(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,n=arguments.length,s=new Array(n>1?n-1:0),r=1;r1?e-1:0),n=1;n1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((i=>{var n;l(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(n=this.references.get(i))&&void 0!==n?n:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return V(t).filter((t=>!l(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}runSync(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluateSync?this.evaluateSync(e,i):this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{h(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return l(this.spec[e])||this.detach(wV(this.spec[e],this.view)),this.spec[e]=t,this.attach(wV(t,this.view)),this.commit(),this}}const MG=(t,e,i)=>{var n,s;if("callback"===t&&o(e))return{references:[],value:{callback:e,dependency:[]}};if(!l(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!l(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!l(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((s=e)&&(s.signal||s.callback)){const t=wV(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(n=null==t?void 0:t[0])&&void 0!==n?n:e}}return{value:e}},CG=(t,e)=>{const i=(n=t.type,rV[n]);var n;if(!i)return;const s={};let r=[];return Object.keys(t).forEach((i=>{var n;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(r=r.concat(SV(a,e))));const o=((t,e,i)=>{if(l(e))return{value:e};if(f(e)){const n=e.map((e=>MG(t,e,i)));return{references:n.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:n.map((t=>t.value))}}return MG(t,e,i)})(i,a,e);o&&((null===(n=o.references)||void 0===n?void 0:n.length)&&(r=r.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:r}},TG=(t,e)=>{if(null==t?void 0:t.length){const i=[];let n=[];return t.forEach((t=>{var s;const r=CG(t,e);r&&((null===(s=r.references)||void 0===s?void 0:s.length)&&(n=n.concat(r.references)),i.push(r))})),{transforms:i,refs:n}}return null};class EG extends jW{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,n,s;const r=!l(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),a=r?this.runtimeStatesEncoder[t]:null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],h={};if(!a)return h;if(o(a))return h.attributes=a(this.getDatum(),this,t,e),h;if(!r&&(null===(s=this.graphicItem.glyphStates)||void 0===s?void 0:s[t]))return this.graphicItem.glyphStates[t];if(a){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return AW(this,i,a,this.mark.parameters()),this.coordinateTransformEncode(i),h.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=h):this.graphicItem.glyphStates={[t]:h},h}return h},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=Object.assign({},t);this.graphicItem=this.mark.addGraphicItem(e,this.groupKey),this.graphicItem[WV]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const i=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const e=i[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=i=>this.mark?_W(e,i,this,t.name):i})),this.clearGraphicAttributes()}useStates(t,e){var i;if(!this.graphicItem)return;this.mark.emit(NV.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const n=a(e)?e:!!(null===(i=this.mark.getSpec().animation)||void 0===i?void 0:i.state);this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(NV.AFTER_ELEMENT_STATE,{states:t},this)}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType);this.graphicItem||this.initGraphicItem(),this.diffState===RV.enter?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==RV.enter&&this.diffState!==RV.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const n=this.glyphMeta.getChannelEncoder(),s=this.glyphMeta.getFunctionEncoder();if(s&&(i=s.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),n){let e;Object.keys(n).forEach((s=>{var r;if(!l(t[s])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=n[s].call(null,s,t[s],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.diffState===RV.enter&&this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),n=_W(this.mark.getAttributeTransforms(),e,this),s=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((n=>{const a=i[n],o=this.glyphGraphicItems[n],l=null==r?void 0:r[n],h=Object.assign({},l);if(t){const t=null==s?void 0:s[n];Object.keys(null!=t?t:{}).forEach((e=>{P(this.items[0].nextAttrs,e)||P(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=yW[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{P(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,n,o),a===OV.shape&&(o.datum=d[0].datum)})),n}}_generateGlyphItems(t,e,i){var n;const s=null===(n=e[0])||void 0===n?void 0:n.nextAttrs,r=e.map((t=>Object.assign({},t,{nextAttrs:i})));return GV.includes(t)&&s.enableSegments&&r.forEach(((t,n)=>{t.nextAttrs=Object.assign({},e[n].nextAttrs,i)})),r}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=this.getPrevGraphicAttributes(i);return e&&P(n,t)?n[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const s=n?this.glyphGraphicItems[n]:this.graphicItem,r=this.getFinalGraphicAttributes(n),a=this.getPrevGraphicAttributes(n);i&&(r[t]=e),P(a,t)||(a[t]=s.attribute[t]),s.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const n=i?this.glyphGraphicItems[i]:this.graphicItem,s=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(s[i]=t[i]),P(r,i)||(r[i]=n.attribute[i])})),n.setAttributes(t)}diffAttributes(t,e){const i={},n=this.getFinalGraphicAttributes(e);for(const e in t)No(e,n,t)||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){if(this.mark.needAnimate()){const n=this.diffAttributes(t,e),s=this.getPrevGraphicAttributes(e),r=this.getFinalGraphicAttributes(e);Object.keys(n).forEach((t=>{s[t]=i.attribute[t],r[t]=n[t]})),this.setNextGraphicAttributes(n,e),this.setPrevGraphicAttributes(s,e),this.setFinalGraphicAttributes(r,e),i.setAttributes(n)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes({}),this.setNextGraphicAttributes({}),this.setFinalGraphicAttributes({}),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes({},t),this.setNextGraphicAttributes({},t),this.setFinalGraphicAttributes({},t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[WV]=null})),this.glyphGraphicItems=null),super.release()}}const PG=t=>t.markType===OV.glyph?new EG(t):new jW(t);function RG(t){return l(t.offsetX)?l(t.x)?t.changedTouches&&t.changedTouches.length?function(t){return{canvasX:t.changedTouches[0].x,canvasY:t.changedTouches[0].y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function OG(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _(e.canvasX)&&Object.defineProperty(t,"canvasX",{value:e.canvasX,writable:!0}),_(e.canvasY)&&Object.defineProperty(t,"canvasY",{value:e.canvasY,writable:!0}),i&&_(e.clientX)&&Object.defineProperty(t,"clientX",{value:e.clientX,writable:!0}),i&&_(e.clientY)&&Object.defineProperty(t,"clientY",{value:e.clientY,writable:!0}),[e.canvasX,e.canvasY]}const BG="window",IG="view",DG={trap:!1},LG="default",FG="width",jG="height",zG="viewWidth",HG="viewHeight",NG="padding",VG="viewBox",WG="autoFit";function GG(t,e,i,n,s){if(s===BG){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{OG(t,RG(t),!1)}))}));const e=RG(t);OG(t,e)}(e.changedTouches?e.changedTouches[0]:e)}return e.element=i,e.vGrammarType=n,e}var UG=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class YG extends kG{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.animate=new bG(this,{}),this.differ=new sW([]),this.evaluateSync=(t,e)=>{var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransformSync(this._getTransformsAfterEncode(),this.elements,e),this},this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,n;if(super.parse(t),this.spec.group){const t=g(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const s=g(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(s),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{})})),Object.keys(null!==(n=t.encode)&&void 0!==n?n:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){if(t.grammarType!==this.grammarType)return this;const e=t;return this.markType=e.markType,this.coord=e.coord,this.elementMap=e.elementMap,this.elements=e.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=e.differ,this.animate=e.animate,this.animate.mark=this,this.context=e.context,this.graphicItem=e.graphicItem,this.graphicIndex=e.graphicIndex,this.graphicParent=e.graphicParent,this.needClear=e.needClear,this.isUpdated=e.isUpdated,this}needLayout(){return!l(this.spec.layout)}handleLayoutEnd(){var t,e;(null===(e=null===(t=this.spec)||void 0===t?void 0:t.layout)||void 0===e?void 0:e.skipBeforeLayouted)&&this.run()}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===RV.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===HV.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const s=this.evaluateTransformSync(this._getTransformsBeforeJoin(),null!=t?t:XV,e);let r=(null==s?void 0:s.progressive)?t:s;return this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e),this.renderContext.progressive?(this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive()):((null==s?void 0:s.progressive)&&(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=s.progressive,r=s.progressive.output()),this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(r),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(NV.AFTER_MARK_ENCODE)),this.emit(NV.BEFORE_MARK_UPDATE),this.update(this.spec),this.emit(NV.AFTER_MARK_UPDATE),this}evaluateGroup(t){var e;if(this.markType===OV.group)return;const i=nW(null!=t?t:XV,TV(null!==(e=this.spec.groupBy)&&void 0!==e?e:()=>YV),this.spec.groupSort),n=i.keys;this._groupKeys=n,this.differ.setCurrentData(i)}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>l(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return UG(this,void 0,void 0,(function*(){return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||(yield this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e)),this}))}output(){return this}join(t,e,i,n,s){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,l(t)||(g(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=n,this.spec.groupSort=s,this.commit(),this}coordinate(t){return g(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e){return this.encodeState(RV.update,t,e)}encodeState(t,e,i){if(t===RV.enter&&(this._isReentered=!0),this.spec.encode[t]){const i=this.spec.encode[t];AV(i)?this.detach(hW(i,this.view)):g(e)?this.detach(hW(this.spec.encode[t][e],this.view)):Object.keys(e).forEach((e=>{this.detach(hW(this.spec.encode[t][e],this.view))}))}else this.spec.encode[t]={};return g(e)?(this.spec.encode[t][e]=i,this.attach(hW(i,this.view))):AV(e)?(this.spec.encode[t]=e,this.attach(hW(e,this.view))):(Object.assign(this.spec.encode[t],e),e&&Object.values(e).forEach((t=>{this.attach(hW(t,this.view))}))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=TG(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms"];return null===t?(e.forEach((t=>{l(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{l(t[e])||(this.spec[e]=t[e])})),this)}isCollectionMark(){return GV.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!l(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==RV.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===VV.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((n=>{const s=t[n];s&&!AV(s)&&Object.keys(s).forEach((t=>{oW(s[t])&&(e[t]=MV(s[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const n=t[i];AV(n)||Object.keys(n).forEach((t=>{lW(n[t])&&(e[t]=n[t].field)}))})),e}init(t,e){var i,n,s,r;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV];if((null==n?void 0:n.mark)===this){const i=GG(this.view,t,n,e,IG);this.emitGrammarEvent(e,i,n)}},this.initEvent()),this.animate||(this.animate=new bG(this,this.spec.animation),this.needAnimate()&&this.animate.updateState(this.spec.animationState)),!this.group){const t=MV(this.spec.group,e);this.group=t,t&&(this.emit(NV.BEFORE_ADD_VRENDER_MARK),t.appendChild(this),this.emit(NV.AFTER_ADD_VRENDER_MARK))}const a=this.group?this.group.getGroupGraphicItem():t.defaultLayer,o=null!==(s=null===(n=null===(i=this.group)||void 0===i?void 0:i.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==s?s:0;if(this.markType!==OV.group){if(!this.graphicItem){const t=DW(this,OV.group,{pickable:!1,zIndex:null!==(r=this.spec.zIndex)&&void 0!==r?r:0});(this.spec.support3d||UV.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}this.graphicParent=this.graphicItem,!a||this.graphicIndex===o&&this.graphicItem.parent===a||a.insertIntoKeepIdx(this.graphicItem,o)}else this.graphicParent=a;this.graphicIndex=o}update(t){this.context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||(t.animation&&this.animate.updateConfig(t.animation),this.animate.updateState(t.animationState)),this.markType!==OV.group?(l(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),l(t.clip)||this.graphicItem.setAttribute("clip",t.clip),this.elementMap.forEach((e=>{e.updateGraphicItem({interactive:t.interactive})}))):this.elementMap.forEach((e=>{e.updateGraphicItem({clip:t.clip,zIndex:t.zIndex,interactive:t.interactive})}))}evaluateJoin(t){var e,i,n,s;this.needClear=!0;const r=TV(null!==(n=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==n?n:()=>YV),a=TV(null!==(s=this.spec.groupBy)&&void 0!==s?s:()=>YV),o=this.spec.sort,h=this.isCollectionMark(),c=new Set(this.elements.filter((t=>t.diffState===RV.enter))),d=[];this.differ.setCallback(((t,e,i)=>{const n=t;let s;if(l(e))s=this.elementMap.get(n),s&&(s.diffState=RV.exit);else if(l(i)){s=this.elementMap.has(n)?this.elementMap.get(n):PG(this),s.diffState===RV.exit&&(s.diffState=RV.enter,this.animate.getElementAnimators(s,RV.exit).forEach((t=>t.stop("start")))),s.diffState=RV.enter;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),this.elementMap.set(n,s),d.push(s)}else if(s=this.elementMap.get(n),s){s.diffState=RV.update;const i=h?t:a(e[0]);s.updateData(i,e,r,this.view),d.push(s)}c.delete(s)}));const u=null!=t?t:XV;h||this.differ.setCurrentData(nW(u,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),c.forEach((t=>{this.elementMap.delete(h?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=d,o&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){var n;if(this.markType===OV.group){const t=this.elements[0],s={};return AW(t,[Object.assign({},null===(n=t.items)||void 0===n?void 0:n[0],{nextAttrs:s})],e,i),s}if(!this._groupKeys||!e)return;const s={};return this._groupKeys.forEach((n=>{var r;const a=t.find((t=>t.groupKey===n));if(!a)return;const o={};AW(a,[Object.assign({},null===(r=a.items)||void 0===r?void 0:r[0],{nextAttrs:o})],e,i),s[n]=o})),s}evaluateEncode(t,e,i){if(e){this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const n=this.evaluateGroupEncode(t,e[PV.group],i);t.forEach((t=>{this.markType===OV.group&&n?t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})):(null==n?void 0:n[t.groupKey])&&!this.isCollectionMark()&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n[t.groupKey])})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==n?void 0:n[t.groupKey]:null)})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem()}))}addGraphicItem(t,e,i){var n;const s=null!=i?i:DW(this,this.markType,t);if(this.emit(NV.BEFORE_ADD_VRENDER_MARK),this.markType===OV.group)s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex);else if(null===(n=this.renderContext)||void 0===n?void 0:n.progressive){let t;if(this._groupKeys){const i=this._groupKeys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(s.incremental=1,t.appendChild(s)):t.incrementalAppendChild(s)}else this.graphicParent.appendChild(s);return this.emit(NV.AFTER_ADD_VRENDER_MARK),s}parseRenderContext(t,e){const i=this.markType!==OV.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this.differ.getCurrentData();return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:n,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:n}}return{large:n}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this.graphicParent.removeAllChild()),(null===(e=this.renderContext)||void 0===e?void 0:e.beforeTransformProgressive)&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&(this.renderContext.progressive.currentIndex=0)}evaluateJoinProgressive(){var t,e,i;const n=this.renderContext.progressive.currentIndex,s=TV(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>YV),r=[];if(this.isCollectionMark())return this._groupKeys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(n*a,(n+1)*a);if(0===n){const e=PG(this);e.diffState=RV.enter,e.updateData(t,o,s,this.view),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,s,this.view),r.push(i)}})),r;const a={};return this._groupKeys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(n*i,(n+1)*i),l=[];o.forEach((e=>{const i=PG(this);i.diffState=RV.enter,i.updateData(t,[e],s,this.view),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){if(!e)return void t.forEach((t=>{t.initGraphicItem()}));const n=Object.keys(e).reduce(((t,i)=>(!e[i]||i!==PV.enter&&i!==PV.exit&&i!==PV.update||(t[i]=function(t,e,i){if(AV(e))return{themeEncoder:{},positionEncoder:e};const n={},s={};if(t===OV.glyph&&uW(i)){const t=uW(i),r=t.getProgressiveChannels();if(r)Object.keys(e).forEach((t=>{r.includes(t)?s[t]=e[t]:n[t]=e[t]}));else{const i=Array.from(new Set(Object.values(t.getMarks())));Object.keys(e).forEach((t=>{i.some((e=>wW(e,t)))?s[t]=e[t]:n[t]=e[t]}))}}else Object.keys(e).forEach((i=>{wW(t,i)?s[i]=e[i]:n[i]=e[i]}));return{positionEncoder:s,themeEncoder:n}}(this.markType,e[i],this.glyphType).positionEncoder),t)),{}),s=this.renderContext.progressive.currentIndex,r=this.isCollectionMark();this.emit(NV.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const a=this.evaluateGroupEncode(t,e[PV.group],i);if(t.forEach(((t,o)=>{const l=s>0||!r&&o>0;!l&&(null==a?void 0:a[t.groupKey])&&t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,a[t.groupKey])})),t.encodeItems(t.items,l?n:e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransformSync(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(NV.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this),0===s&&!r){const e=t[0].getGraphicItem(),i=null==e?void 0:e.parent;if(i){const t=e.attribute,n={},s={};Object.keys(t).forEach((e=>{["pickable","zIndex"].includes(e)||(wW(this.markType,e)?s[e]=t[e]:n[e]=t[e])})),i.setTheme({common:n}),e.initAttributes(s)}}}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){this.renderContext.beforeTransformProgressive.progressiveRun();const t=this.renderContext.beforeTransformProgressive.output();return this.emit(NV.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(NV.AFTER_MARK_JOIN),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(NV.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const n=this.renderContext.parameters;this.emit(NV.BEFORE_MARK_JOIN);const s=this.evaluateJoinProgressive(),r=Array.isArray(s)?s:s.elements;if(this.emit(NV.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupKeys.forEach((t=>{const e=DW(this,OV.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(NV.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,n),this.emit(NV.AFTER_MARK_STATE),this.emit(NV.BEFORE_MARK_ENCODE),Array.isArray(s))this.evaluateEncodeProgressive(r,this._getEncoders(),n);else{const t=s.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),n)}))}this.emit(NV.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransformSync(a,this.elements,n),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==RV.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){var t,e,i;return null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)}getBounds(){var t,e,i,n;return this.graphicItem?this.graphicItem.AABBBounds:null===(n=null===(i=null===(e=null===(t=this.elements)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:yW[this.markType]}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){this._delegateEvent&&this.view.renderer.stage().on("*",this._delegateEvent)}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;super.clear(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null}prepareRelease(){this.animate.stop(),this.elementMap.forEach((t=>t.diffState=RV.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&FW(this.graphicItem),this.detachAll(),super.release()}}class XG extends YG{constructor(t,e,i){super(t,OV.component,i),this._componentDatum={[YV]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const n=null!=i?i:PW(this.componentType).creator(t);return super.addGraphicItem(t,e,n)}join(t){return super.join(t,YV)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}_prepareRejoin(){this._componentDatum[YV]+=1}evaluateJoin(t){return this.spec.key=YV,super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}_filterData(t,e,i,n,s,r){const a=g(t)?this.view.getDataById(t):t;a&&(a.removeDataFilter(this._dataFilter),this._filterCallback=null,this._dataFilter=null);const o=g(e)?this.view.getDataById(e):e;return o&&(this._filterCallback=(t,e)=>{e&&e.mark===this&&o&&(this._filterValue=n(t),o.commit(),this.view.runAsync())},this._dataFilter={source:`${this.uid}`,rank:i,filter:t=>{if(!this._filterValue)return t;const e=s?t.filter((t=>s(t,this._filterValue))):t;return r?r(e,this._filterValue):e}},o.addDataFilter(this._dataFilter)),this}}const $G=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex"];class KG extends zE{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";super(t),this.mode=e,this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){u(this.attribute[t])?D(this.attribute[t],e):this.attribute[t]=e,$G.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>$G.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){l(e)&&(e=Object.keys(t));for(let i=0;i{var e,i;const{viewX:n,viewY:s}=t,{direction:r,width:a,height:o,range:l}=this.attribute,h=this._sliderSize,[c,d]=this._getScrollRange();let u;if("vertical"===r){const t=s-this._viewPosition.y,e=ut(t-h/2,c,d);u=t/o,this._slider.setAttribute("y",e,!0)}else{const t=n-this._viewPosition.x,e=ut(t-h/2,c,d);u=t/a,this._slider.setAttribute("x",e,!0)}this.setScrollRange([u-(l[1]-l[0])/2,u+(l[1]-l[0])/2],!1),(null===(e=this.stage)||void 0===e?void 0:e.autoRender)||null===(i=this.stage)||void 0===i||i.renderNextFrame()},this._onSliderPointerDown=t=>{t.stopPropagation();const{direction:e}=this.attribute;this._prePos="horizontal"===e?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onSliderPointerMove),XH.addEventListener("pointerup",this._onSliderPointerUp)):(this._slider.addEventListener("pointermove",this._onSliderPointerMove),this._slider.addEventListener("pointerup",this._onSliderPointerUp),this._slider.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._onSliderPointerMove=t=>{t.stopPropagation();const{direction:e}=this.attribute;let i,n,s=0;const r=this.getScrollRange(),{width:a,height:o}=this._getSliderRenderBounds();"vertical"===e?(n=t.clientY,s=n-this._prePos,i=s/o):(n=t.clientX,s=n-this._prePos,i=s/a),this.setScrollRange([r[0]+i,r[1]+i],!0),this._prePos=n},this._onSliderPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onSliderPointerMove),XH.removeEventListener("pointerup",this._onSliderPointerUp)):(this._slider.removeEventListener("pointermove",this._onSliderPointerMove),this._slider.removeEventListener("pointerup",this._onSliderPointerUp),this._slider.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];var i,n;const{direction:s="horizontal",limitRange:r=[0,1],range:a}=this.attribute,o=pt(t,r[0],r[1]);if(e){const t=this._getSliderPos(o);this._slider&&("horizontal"===s?this._slider.setAttribute("x",t[0],!0):this._slider.setAttribute("y",t[0],!0),(null===(i=this.stage)||void 0===i?void 0:i.autoRender)||null===(n=this.stage)||void 0===n||n.renderNextFrame())}this.attribute.range=o,this._onChange({pre:a,value:o})}getScrollRange(){return this.attribute.range}bindEvents(){this._rail&&this._rail.addEventListener("pointerdown",this._onRailPointerDown),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:n,limitRange:s=[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(pt(n,s[0],s[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:Ze(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,[n,s,r,a]=Ze(i),o={x1:a,y1:n,x2:t-s,y2:e-r,width:t-(a+s),height:e-(n+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:n,x1:s,y1:r}=this._getSliderRenderBounds();return"horizontal"===e?[i*t[0]+s,i*t[1]+s]:[n*t[0]+r,n*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,n]=pt(t,0,1),{width:s,height:r,x1:a,y1:o}=this._getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?pt([a+i*s,a+n*s],a,s-l):pt([o+i*r,o+n*r],o,r-l)}_onChange(t){var e;const i=new wC("scroll",t);i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(i)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function ZG(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&ZG(t,e)}))}qG.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]};const JG=t=>!l(t)&&!1!==t.visible;const QG=["#ffffff","#000000"];function tU(t,e,i,n,s){const r=sU(t),a=sU(e);return eU(r,a,i,n)?r:function(t,e,i,n,s){const r=[];s&&(s instanceof Array?r.push(...s):r.push(s)),r.push(...QG);for(const s of r)if(t!==s&&eU(s,e,i,n))return s}(r,a,i,n,s)}function eU(t,e,i,n){return n?iU(t,e)>n:"largeText"===i?iU(t,e)>3:iU(t,e)>4.5}function iU(t,e){const i=nU(t),n=nU(e);return((i>n?i:n)+.05)/((i>n?n:i)+.05)}function nU(t){const e=pe(t),i=e[0]/255,n=e[1]/255,s=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function sU(t){if(null==t?void 0:t.includes("#"))return t;const e=new de(t),{r:i,g:n,b:s}=e.color;return"#"+ge(i,n,s)}function rU(t,e,i,n){let s;switch(t){case"base":s=e;break;case"invertBase":s=i;break;case"similarBase":s=n}return s}function aU(t,e){return[t[0]*e,t[1]*e]}function oU(t,e,i){const n=function(t,e){const[i,n]=t,[s,r]=e,a=Math.sqrt((i*i+n*n)*(s*s+r*r)),o=a&&(i*s+n*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),s=function(t,e){return t[0]*e[1]-e[0]*t[1]}(t,e)>=0;return i?s?2*Math.PI-n:n:s?n:2*Math.PI-n}const lU=-.5*Math.PI,hU=1.5*Math.PI,cU="PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol";var dU;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(dU||(dU={}));const uU={[dU.selectedReverse]:{},[dU.selected]:{},[dU.hover]:{},[dU.hoverReverse]:{}},pU=(t,e,i)=>new Ye(Object.assign({defaultFontParams:{fontFamily:cU,fontSize:11},getTextBounds:i?void 0:KO,specialCharSet:"-/: .,@%'\"~"+Ye.ALPHABET_CHAR_SET+Ye.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function gU(t,e){var i,n;if(!t)return{width:0,height:0};const s=KO({text:t,fontFamily:null!==(i=e.fontFamily)&&void 0!==i?i:"",fontSize:e.fontSize||12,fontWeight:e.fontWeight,textAlign:null!==(n=e.textAlign)&&void 0!==n?n:"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||12});return{width:s.width(),height:s.height()}}var fU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sc&&(m=c,k.setAttribute("maxLineWidth",c-g[1]-g[2])));let I=0,D=0;"center"===O?(I-=m/2,v&&v.setAttribute("x",(v.attribute.x||0)-T/2),f.setAttribute("x",-x/2)):"right"===O||"end"===O?(I-=m,v&&v.setAttribute("x",(v.attribute.x||0)-T),f.setAttribute("x",-g[1]-x)):"left"!==O&&"start"!==O||f.setAttribute("x",g[3]),"middle"===B?(D-=_/2,v&&v.setAttribute("y",0)):"bottom"===B?(D-=_,v&&v.setAttribute("y",-E/2),f.setAttribute("y",-g[2])):"top"===B&&(f.setAttribute("y",g[0]),v&&v.setAttribute("y",E/2));const{visible:L}=s,F=fU(s,["visible"]);if(u&&a(L)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},F),{visible:L&&!!e,x:I,y:D,width:m,height:_}),"rect");C(null==p?void 0:p.panel)||(t.states=p.panel)}}}vU.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};var mU=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);sm?W=m:Wye&&([me,ye]=[ye,me]),_e>be&&([_e,be]=[be,_e]),xe>Se&&([xe,Se]=[Se,xe]),we>Ae&&([we,Ae]=[Ae,we])),me>xe&&yewe&&beme&&Se_e&&AeQ&&(Q=s,J=t)}}}var tt,et,it}getAngleAndOffset(t,e,i,n){const s=n[1]/2;switch(t){case"tl":return{angle:kt/2*3,offset:[e/4,i+s],rectOffset:[-e/4,-i-n[1]]};case"top":return{angle:kt/2*3,offset:[e/2,i+s],rectOffset:[0,-i-n[1]]};case"tr":return{angle:kt/2*3,offset:[e/4*3,i+s],rectOffset:[e/4*3,-i-n[1]]};case"rt":return{angle:0,offset:[-s,i/5],rectOffset:[e/4*3,-i-n[1]]};case"right":return{angle:0,offset:[-s,i/2],rectOffset:[e/4*3,-i-n[1]]};case"rb":return{angle:0,offset:[-s,i/5*4],rectOffset:[e/4*3,-i-n[1]]};case"bl":return{angle:kt/2,offset:[e/4,-s],rectOffset:[-e/4,-i-n[1]]};case"bottom":return{angle:kt/2,offset:[e/2,-s],rectOffset:[0,-i-n[1]]};case"br":return{angle:kt/2,offset:[e/4*3,-s],rectOffset:[e/4*3,-i-n[1]]};case"lt":return{angle:kt,offset:[e+s,i/5],rectOffset:[-e/4,-i-n[1]]};case"left":return{angle:kt,offset:[e+s,i/2],rectOffset:[0,-i-n[1]]};case"lb":return{angle:kt,offset:[e+s,i/5*4],rectOffset:[e/4*3,-i-n[1]]}}}}_U.defaultAttributes={position:"rt",visible:!0,title:null,content:null,titleStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},contentStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},maxWidthPercent:.8,space:8,padding:10};const bU={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}},xU={poptip:D({},bU)};var SU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wU=class{render(t,e,i,n,s,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 n={};D(n,_U.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(n):this.poptipComponent=new _U(n);let s=t.attribute.poptip||{};if("text"===t.type&&null==s.title&&null==s.content){const e={};g=s,D(e,xU.poptip,g),s=e,s.content=null!==(p=s.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},s),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&this.poptipComponent.setAttributes({visibleAll:!1}))}};wU=SU([fA()],wU);var AU=function(t,e,i,n){var s,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(s=t[o])&&(a=(r<3?s(a):r>3?s(e,i,a):s(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kU=class{constructor(){this.name="poptip",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if(e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};kU=AU([fA()],kU);let MU=class{constructor(){this.name="poptipForText",this.activeEvent="onRegister",this._uid=vC.GenAutoIncrementId(),this.key=this.name+this._uid,this.poptip=t=>{const e=t.target;if("text"!==e.type||!e.cliped||e.isContainer||!e.attribute)return void this.unpoptip(t);if(e===this.activeGraphic)return;const{poptip:i={}}=e.attribute;i&&(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)}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}};MU=AU([fA()],MU);const CU=new cA((t=>{t(wU).toSelf().inSingletonScope(),t(kP).toService(wU),t(kU).toSelf().inSingletonScope(),t(hL).toService(kU),t(MU).toSelf().inSingletonScope(),t(hL).toService(MU)}));class TU extends KG{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}class EU extends TU{constructor(t){super(D({},EU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},n),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}EU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};class PU extends TU{constructor(t){super(D({},PU.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:n}=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},n),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}PU.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};class RU extends TU{constructor(t){super(D({},RU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:n}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),n),"arc")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}RU.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}};class OU extends TU{constructor(t){super(D({},OU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:n=0,sectorStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:n,startAngle:r,endAngle:a}),s),"arc")}setLocation(t){const{center:e,startAngle:i=lU,endAngle:n=hU}=this.attribute,s=n-i,r=qt(te(e,t));this.setAttributes({startAngle:r-s/2,endAngle:r+s/2})}}OU.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}};class BU extends TU{constructor(t){super(D({},BU.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:n=6,lineStyle:s}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/n;let h;for(let t=0;t<=n;t++){const s=Qt(e,i,r+l*t);0===t?h=`M${s.x},${s.y}`:h+=`L${s.x},${s.y}`,t===n&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},s),"path")}setLocation(t){const{center:e}=this.attribute,i=Ut.distancePP(t,e);this.setAttribute("radius",i)}}BU.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const IU=new Uint32Array(33),DU=new Uint32Array(33);DU[0]=0,IU[0]=~DU[0];for(let t=1;t<=32;++t)DU[t]=DU[t-1]<<1|1,IU[t]=~DU[t];function LU(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=Math.max(1,Math.sqrt(t*e/1e6)),s=~~((t+2*i+n)/n),r=~~((e+2*i+n)/n),a=t=>~~((t+i)/n);return a.invert=t=>t*n-i,a.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function n(t,e){i[t]|=e}function s(t,e){i[t]&=e}return{array:i,get:(e,n)=>{const s=n*t+e;return i[s>>>5]&1<<(31&s)},set:(e,i)=>{const s=i*t+e;n(s>>>5,1<<(31&s))},clear:(e,i)=>{const n=i*t+e;s(n>>>5,~(1<<(31&n)))},getRange:n=>{let{x1:s,y1:r,x2:a,y2:o}=n;if(a<0||o<0||s>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+s,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&IU[31&l]&DU[1+(31&h)])return!0}else{if(i[c]&IU[31&l])return!0;if(i[d]&DU[1+(31&h)])return!0;for(let t=c+1;t{let s,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(s=c*t+h,r=c*t+d,a=s>>>5,o=r>>>5,a===o)n(a,IU[31&s]&DU[1+(31&r)]);else for(n(a,IU[31&s]),n(o,DU[1+(31&r)]),l=a+1;l{let i,n,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,n=h*t+c,r=i>>>5,a=n>>>5,r===a)s(r,DU[31&i]|IU[1+(31&n)]);else for(s(r,DU[31&i]),s(a,IU[1+(31&n)]),o=r+1;o{let{x1:n,y1:s,x2:r,y2:a}=i;return n<0||s<0||a>=e||r>=t},toImageData:n=>{const s=n.createImageData(t,e),r=s.data;for(let n=0;n>>5]&1<<(31&s);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return s}}}(s,r),a.ratio=n,a.padding=i,a.width=t,a.height=e,a}function FU(t,e){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){const{x1:i,x2:n,y1:s,y2:r}=e,a=ut(i,0,t.width),o=ut(n,0,t.width),l=ut(s,0,t.height),h=ut(r,0,t.height);return{x1:t(a),x2:t(o),y1:t(l),y2:t(h)}}return{x1:t(e.x1),x2:t(e.x2),y1:t(e.y1),y2:t(e.y2)}}function jU(t,e,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;return s>0&&(r={x1:i.x1-s,x2:i.x2+s,y1:i.y1-s,y2:i.y2+s}),r=FU(t,r),!(n&&e.outOfBounds(r)||e.getRange(r))}function zU(t,e,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;for(let a=0;aa(s.AABBBounds,r,t,n.offset)));return zU(t,e,s,l,c,d)}return!1}var u;if("moveY"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x,y:s.attribute.y+t})));return zU(t,e,s,n,c,d)}if("moveX"===i.type){const n=(i.offset?o(i.offset)?i.offset(s.attribute):i.offset:[]).map((t=>({x:s.attribute.x+t,y:s.attribute.y})));return zU(t,e,s,n,c,d)}return!1}const NU=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],VU=["top","inside-top","inside"];function WU(t,e,i){const{x1:n,x2:s,y1:r,y2:a}=t.AABBBounds,o=Math.min(n,s),l=Math.max(n,s),h=Math.min(r,a),c=Math.max(r,a);let d=0,u=0;return o<0&&l-o<=e?d=-o:l>e&&o-(l-e)>=0&&(d=e-l),h<0&&c-h<=i?u=-h:c>i&&h-(c-i)>=0&&(u=i-c),{dx:d,dy:u}}const GU={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,n;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=t.strokeOpacity)&&void 0!==n?n:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function UU(t,e){var i,n;return null!==(n=null===(i=GU[e])||void 0===i?void 0:i.call(GU,t))&&void 0!==n?n:{from:{},to:{}}}const YU="same-time",XU=300,$U="linear";class KU extends KG{setBitmap(t){this._bitmap=t}setBitmapTool(t){this._bmpTool=t}constructor(t){super(D({},KU.defaultAttributes,t)),this.name="label",this._onHover=t=>{const e=t.target;e===this._lastHover||C(e.states)||(e.addState(dU.hover,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this,(t=>{C(t.states)||(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void ZG(this,(t=>{C(t.states)||(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));C(e.states)||(e.addState(dU.selected,!0),ZG(this,(t=>{t===e||C(t.states)||t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}labeling(t,e,i,n){}_labelLine(t){}render(){if(this._prepare(),l(this._idToGraphic))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:n,customOverlapFunc:s}=this.attribute;let r,a=this.attribute.data;o(i)&&(a=i(a)),r=o(n)?n(a,(t=>this._idToGraphic.get(t.id))):this._layout(a),o(s)?r=s(r,(t=>this._idToGraphic.get(t.id))):!1!==t&&(r=this._overlapping(r)),!1!==e&&this._smartInvert(r),this._renderLabels(r)}_bindEvent(t){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)}_setStates(t){if(!t)return;const e=this.attribute.state;e&&!C(e)&&(t.states=e)}_createLabelText(t){const e=VO(t);return this._bindEvent(e),this._setStates(e),e}_prepare(){var t;const e=function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),i=[];if(e.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),this._baseMarks=i,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){this._idToGraphic||(this._idToGraphic=new Map);for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={},position:i,offset:n}=this.attribute,s=[];for(let r=0;r"bound"===t.type));c&&(null===(s=this._baseMarks)||void 0===s||s.forEach((t=>{t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}))),f.length>0&&f.forEach((t=>{g(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&&y.setRange(FU(m,t.AABBBounds,!0))})):t.AABBBounds&&y.setRange(FU(m,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(null==t?void 0:t.AABBBounds)||{x1:e.x,x2:e.x,y1:e.y,y2:e.y}}_renderLabels(t){!1===this._enableAnimation||!1===this.attribute.animation?this._renderWithOutAnimation(t):this._renderWithAnimation(t)}_renderWithAnimation(t){var e,i,n,s,r;const a=null!==(e=this.attribute.animation)&&void 0!==e?e:{},o=null!==(i=a.mode)&&void 0!==i?i:YU,l=null!==(n=a.duration)&&void 0!==n?n:XU,h=null!==(s=a.easing)&&void 0!==s?s:$U,c=null!==(r=a.delay)&&void 0!==r?r:0,d=new Map,u=this._graphicToText||new Map,p=[];t.forEach(((t,e)=>{var i;const n=this._labelLine(t),s=this._idToGraphic.get(t.attribute.id),r=(null==u?void 0:u.get(s))?"update":"enter";if("enter"===r){if(p.push(t),d.set(s,n?{text:t,labelLine:n}:{text:t}),s){const{from:i,to:r}=UU(t.attribute,"fadeIn");this.add(t),n&&this.add(n),s.once("animate-bind",(()=>{t.setAttributes(i);const n=this._afterRelatedGraphicAttributeUpdate(t,p,e,s,{mode:o,duration:l,easing:h,to:r,delay:c});s.on("afterAttributeUpdate",n)}))}}else if("update"===r){const e=u.get(s);u.delete(s),d.set(s,e);const n=e.text;n.animate().to(t.attribute,l,h),e.labelLine&&e.labelLine.animate().to(D({},e.labelLine.attribute,{points:null===(i=t.attribute)||void 0===i?void 0:i.points}),l,h),!1!==a.increaseEffect&&n.attribute.text!==t.attribute.text&&_(Number(n.attribute.text)*Number(t.attribute.text))&&n.animate().play(new lT({text:n.attribute.text},{text:t.attribute.text},l,h))}})),u.forEach((t=>{var e;null===(e=t.text)||void 0===e||e.animate().to(UU(t.text.attribute,"fadeOut").to,l,h).onEnd((()=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)}))})),this._graphicToText=d}_renderWithOutAnimation(t){const e=new Map,i=this._graphicToText||new Map;t.forEach((t=>{var n;const s=this._labelLine(t),r=this._idToGraphic.get(t.attribute.id),a=(null==i?void 0:i.get(r))?"update":"enter";if("enter"===a)e.set(r,s?{text:t,labelLine:s}:{text:t}),this.add(t),s&&this.add(s);else if("update"===a){const s=i.get(r);i.delete(r),e.set(r,s),s.text.setAttributes(t.attribute),(null==s?void 0:s.labelLine)&&s.labelLine.setAttributes({points:null===(n=t.attribute)||void 0===n?void 0:n.points})}})),i.forEach((t=>{this.removeChild(t.text),(null==t?void 0:t.labelLine)&&this.removeChild(t.labelLine)})),this._graphicToText=e}_afterRelatedGraphicAttributeUpdate(t,e,i,n,s){let{mode:r,duration:a,easing:o,to:l,delay:h}=s;const c=s=>{var d;const{detail:u}=s;if(!u)return{};if(!u||u.type!==$A.ANIMATE_UPDATE||!u.animationState||"wait"===(null===(d=u.animationState.step)||void 0===d?void 0:d.type))return{};if(u.type===$A.ANIMATE_END)return void t.setAttributes(l);const p=()=>{n&&(n.onAnimateBind=void 0,n.removeEventListener("afterAttributeUpdate",c))};switch(r){case"after":u.animationState.end&&t.animate({onEnd:p}).wait(h).to(l,a,o);break;case"after-all":i===e.length-1&&u.animationState.end&&e.forEach((t=>{t.animate({onEnd:p}).wait(h).to(l,a,o)}));break;default:u.animationState.isFirstFrameOfStep&&t.animate({onEnd:p}).wait(h).to(l,a,o)}};return c}_smartInvert(t){var e,i,n,s;const r=this.attribute.smartInvert||{},{textType:a,contrastRatiosThreshold:o,alternativeColors:l}=r,h=null!==(e=r.fillStrategy)&&void 0!==e?e:"invertBase",c=null!==(i=r.strokeStrategy)&&void 0!==i?i:"base",d=null!==(n=r.brightColor)&&void 0!==n?n:"#ffffff",u=null!==(s=r.darkColor)&&void 0!==s?s:"#000000";if("null"!==h||"null"!==c)for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),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 v={"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(v[i]*(Math.PI/180)),p=Math.cos(v[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(n+g)+Math.sign(u)*(l/2),y:d+p*(n+f)+Math.sign(p)*(h/2)}}}qU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class ZU extends KU{constructor(t){super(D({},ZU.defaultAttributes,t))}labeling(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:s,y1:r,x2:a,y2:o}=t,l=Math.abs(a-s),h=Math.abs(o-r),c=Math.abs(e.x2-e.x1),d=Math.abs(e.y2-e.y1);let u=(e.x1+e.x2)/2,p=(e.y1+e.y2)/2,g=0,f=0;switch(i){case"top":case"inside-top":f=-.5;break;case"bottom":case"inside-bottom":f=.5;break;case"left":case"inside-left":g=-.5;break;case"right":case"inside-right":g=.5}u+=g*c,p+=f*d;let v=0,m=0;const y=i.includes("inside");return i.includes("top")?m=y?1:-1:i.includes("bottom")?m=y?-1:1:i.includes("left")?v=y?1:-1:i.includes("right")&&(v=y?-1:1),{x:u+v*n+v*l/2,y:p+m*n+m*h/2}}}function JU(t,e,i,n){const s=function(t){return t.radius?{x:Math.cos(t.angle)*t.radius,y:Math.sin(t.angle)*t.radius}:{x:0,y:0}}({radius:i,angle:n});return{x:t+s.x,y:e+s.y}}function QU(t){return(t=function(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}(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 tY(t){return 3===t||4===t}function eY(t,e){const{x1:i,y1:n,x2:s,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&s<=a||i>=l&&s>=l||n<=o&&r<=o||n>=h&&r>=h)}ZU.tag="rect-label",ZU.defaultAttributes={textStyle:{fontSize:12,fill:"#000",textAlign:"center",textBaseline:"middle",boundsPadding:[-1,0,-1,0]},position:"top",offset:5,pickable:!1};class iY{constructor(t,e,i,n,s,r){this.refDatum=t,this.center=e,this.outerCenter=i,this.quadrant=n,this.radian=s,this.middleAngle=r,this.labelVisible=!0,this.labelLimit=0}getLabelBounds(){return this.labelPosition&&this.labelSize?{x1:this.labelPosition.x-this.labelSize.width/2,y1:this.labelPosition.y-this.labelSize.height/2,x2:this.labelPosition.x+this.labelSize.width/2,y2:this.labelPosition.y+this.labelSize.height/2}:{x1:0,x2:0,y1:0,y2:0}}}class nY extends KU{constructor(t){super(D({},nY.defaultAttributes,t)),this.name="arc-label",this._ellipsisWidth=0,this._arcLeft=new Map,this._arcRight=new Map}_overlapping(t){return t}labeling(t,e){if(t&&e)return{x:0,y:0}}_layout(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=super._layout(t),i=e.map((t=>this.getGraphicBounds(t))),n=Object.assign(Object.assign({},this.attribute.textStyle),{text:"..."}),s=this._createLabelText(n),r=this.getGraphicBounds(s),a=r.x2-r.x1,o=this.layoutArcLabels(this.attribute.position,this.attribute,Array.from(this._idToGraphic.values()),t,i,a);for(let i=0;it.refDatum.id===n.id)),r={visible:s.labelVisible,x:s.labelPosition.x,y:s.labelPosition.y,angle:s.angle,maxLineWidth:s.labelLimit,points:(null==s?void 0:s.pointA)&&(null==s?void 0:s.pointB)&&(null==s?void 0:s.pointC)?[s.pointA,s.pointB,s.pointC]:void 0,line:null==s?void 0:s.labelLine};e[i].setAttributes(r)}return e}layoutArcLabels(t,e,i,n,s,r){var a;this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;const o=null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0;let l=0;i.forEach((t=>{t.attribute.outerRadius>l&&(l=t.attribute.outerRadius)})),i.forEach(((t,i)=>{var r,a;const h=t.attribute,c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(a=null==h?void 0:h.y)&&void 0!==a?a:0},d=n[i],u=s[i],p=(h.startAngle+h.endAngle)/2,g=h.endAngle-h.startAngle,f=QU(h.endAngle-g/2),v=JU(c.x,c.y,h.outerRadius,p),m=JU(c.x,c.y,l+e.line.line1MinLength,p),y=new iY(d,v,m,f,g,p);var _;y.pointA=JU(c.x,c.y,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius,o),y.middleAngle),y.labelSize={width:u.x2-u.x1,height:u.y2-u.y1},1===(_=y.quadrant)||2===_?this._arcRight.set(y.refDatum,y):tY(y.quadrant)&&this._arcLeft.set(y.refDatum,y)}));const h=Array.from(this._arcLeft.values()),c=Array.from(this._arcRight.values()),d=[];return"inside"===t?(d.push(...this._layoutInsideLabels(c,e,i)),d.push(...this._layoutInsideLabels(h,e,i))):(d.push(...this._layoutOutsideLabels(c,e,i)),d.push(...this._layoutOutsideLabels(h,e,i))),d}_layoutInsideLabels(t,e,i){var n,s,r,a,o;const l={x:null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,y:null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0},h=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,c=this.computeLayoutOuterRadius(i[0].attribute.innerRadius,e.width,e.height),d=this.computeLayoutOuterRadius(i[0].attribute.outerRadius,e.width,e.height),u=e,p=u.spaceWidth;return t.forEach((t=>{var i,n;const{labelSize:s,radian:r}=t,a=this.computeRadius(c,e.width,e.height,h,1),o=this.computeRadius(d,e.width,e.height,h,1);let g;if(r2*t?NaN:2*Math.asin(e/2/t)}(o,s.height))g=0;else{let t;t=r>=Math.PI?a:Math.max(a,s.height/2/Math.tan(r/2)),g=o-t-p}!0!==(null==u?void 0:u.rotate)&&(g=o-p);const f=this._getFormatLabelText(t.refDatum,g);t.labelText=f;const v=Math.min(g,t.labelSize.width),m=this._computeAlign(t,e),y=o-p-("left"===m?v:"right"===m?0:v/2);t.labelPosition=JU(l.x,l.y,y,t.middleAngle),t.labelLimit=v,ot(v,0)||(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:t.middleAngle})),t}_layoutOutsideLabels(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),c=e.line.line2MinLength,d=e.layout,u=e.spaceWidth;if(t.forEach((t=>{const e=tY(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+c+u),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===d.strategy){for(const n of t){const{labelPosition:t,labelSize:s}=n;n.labelLimit=s.width,n.pointB=tY(n.quadrant)?{x:t.x+s.width/2+c+u,y:t.y}:{x:t.x-s.width/2-c-u,y:t.y},this._computeX(n,e,i)}!1===e.coverEnable&&"none"===d.strategy&&this._coverLabels(t)}else{const n=h/((null===(o=e.textStyle)||void 0===o?void 0:o.fontSize)||16);this._adjustY(t,n,e,i);const{minY:s,maxY:r}=t.reduce(((t,e)=>{const{y1:i,y2:n}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(h,Math.max(n,t.maxY)),t}),{minY:1/0,maxY:-1/0}),a=Math.max(Math.abs(h/2-s),Math.abs(r-h/2)),l=this._computeLayoutRadius(a,e,i);for(const n of t)this._computePointB(n,l,e,i),this._computeX(n,e,i)}const p=2*l;return t.forEach((t=>{var i,n;t.labelVisible&&(lt(t.pointB.x,c+u)||ot(t.pointB.x,p-c-u))&&(t.labelVisible=!1),t.angle=null!==(n=null===(i=null==e?void 0:e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==n?n:0,t.labelLine=Object.assign({},null==e?void 0:e.line)})),t}_computeX(t,e,i){var n,s,r,a,o;const l=null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0,h=(null===(r=i[0].attribute)||void 0===r||r.y,null!==(a=null==e?void 0:e.centerOffset)&&void 0!==a?a:0),c=2*l;let d=0;i.forEach((t=>{t.attribute.outerRadius>d&&(d=t.attribute.outerRadius)}));const u=this.computeLayoutOuterRadius(d,e.width,e.height),p=e.line.line1MinLength,g=e.line.line2MinLength,f=null===(o=e.layout)||void 0===o?void 0:o.align,v=e.spaceWidth,{labelPosition:m,quadrant:y,pointB:b}=t;_(b.x*b.y)||(t.pointC={x:NaN,y:NaN},m.x=NaN,t.labelLimit=0);const x=this.computeRadius(u,e.width,e.height,h),S=tY(y)?-1:1;let w=0,A=(S>0?c-b.x:b.x)-g-v;"labelLine"===f&&(w=(x+p+g)*S+l,A=(S>0?c-w:w)-v);const k=this._getFormatLabelText(t.refDatum,A);t.labelText=k;let M=Math.min(A,t.labelSize.width);switch(f){case"labelLine":break;case"edge":w=S>0?c-M-v:M+v;break;default:w=b.x+S*g}M=Math.max(this._ellipsisWidth,M),t.labelLimit=M,t.pointC={x:w,y:m.y};const C=.5*(t.labelLimit0?c+t:t)-S*C}else{const t=0;m.x=w+t+S*(v+C)}}_computeAlignOffset(t,e,i){switch(t){case"left":return i<0?-e:0;case"right":return i<0?0:e;default:return e/2*i}}_computeAlign(t,e){var i,n,s,r,a,o;const h=e,c=null!==(n=null===(i=h.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==n?n:null===(s=h.textStyle)||void 0===s?void 0:s.align,d=null!==(a=null===(r=h.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=h.layout)||void 0===o?void 0:o.align;return"inside"!==h.position?l(c)||"auto"===c?"edge"===d?tY(t.quadrant)?"left":"right":tY(t.quadrant)?"right":"left":c:l(c)||"auto"===c?"center":c}_getFormatLabelText(t,e){return t.text}_adjustY(t,e,i,n){var s,r,a;null===(s=n[0].attribute)||void 0===s||s.x;const o=2*(null!==(a=null===(r=n[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0),l=i.layout;if("vertical"===l.strategy){let e,i=0;const n=t.length;if(n<=0)return;for(let s=0;s=0&&t[e].getLabelBounds().y2>o;e--)t[e].labelVisible=!1}else if("none"!==l.strategy){const s=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));s.sort(((t,e)=>e.arc.radian-t.arc.radian)),s.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let r=1/0,a=-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;cn?(e.labelPosition.y=n-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,s[h].originIndex)):c=0&&e0&&no)return r}r=e}return i}_findNextVisibleIndex(t,e,i,n){const s=(i-e)*n;for(let i=1;i<=s;i++){const s=e+i*n;if(t[s].labelVisible)return s}return-1}_computePointB(t,e,i,n){var s,r,a,o,l;const h=i;let c=0;n.forEach((t=>{t.attribute.outerRadius>c&&(c=t.attribute.outerRadius)}));const d=this.computeLayoutOuterRadius(c,i.width,i.height),u=h.line.line1MinLength;if("none"===h.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const h={x:null!==(r=null===(s=n[0].attribute)||void 0===s?void 0:s.x)&&void 0!==r?r:0,y:null!==(o=null===(a=n[0].attribute)||void 0===a?void 0:a.y)&&void 0!==o?o:0},c=null!==(l=null==i?void 0:i.centerOffset)&&void 0!==l?l:0,p=this.computeRadius(d,i.width,i.height,c),{labelPosition:g,quadrant:f}=t,v=e-Math.max(p+u,n[0].attribute.outerRadius),m=Math.sqrt(e**2-Math.abs(h.y-g.y)**2)-v;_(m)?t.pointB={x:h.x+m*(tY(f)?-1:1),y:g.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){var n,s,r,a,o;const l={width:2*(null!==(s=null===(n=i[0].attribute)||void 0===n?void 0:n.x)&&void 0!==s?s:0),height:2*(null!==(a=null===(r=i[0].attribute)||void 0===r?void 0:r.y)&&void 0!==a?a:0)};let h=0;i.forEach((t=>{t.attribute.outerRadius>h&&(h=t.attribute.outerRadius)}));const c=this.computeLayoutOuterRadius(h,e.width,e.height),d=e.line.line1MinLength,{width:u,height:p}=l,g=null!==(o=null==e?void 0:e.centerOffset)&&void 0!==o?o:0,f=this.computeRadius(c,e.width,e.height,g),v=this._computeLayoutRadius(p/2,e,i),m=Math.abs(t.center.x-u/2),y=t.center.y-p/2;let _,b,x;if(at(u/2,m))_=0,b=1,x=-y;else if(at(p/2,y))_=1,b=0,x=-m;else{const t=-1/(y/m);_=t,b=-1,x=y-t*m}const S=function(t,e,i,n,s,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-s)**2;return a<0?[]:0===a?[{x:n,y:t}]:[{x:Math.sqrt(a)+n,y:t},{x:-Math.sqrt(a)+n,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-n)**2;return a<0?[]:0===a?[{x:e,y:s}]:[{x:e,y:Math.sqrt(a)+s},{x:e,y:-Math.sqrt(a)+s}]}const a=(e/t)**2+1,o=2*((i/t+n)*(e/t)-s),l=o**2-4*a*((i/t+n)**2+s**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}]}(_,b,x,d+f-v,0,v);if(S.length<2)return;let w,A;S[0].x>S[1].x&&S.reverse(),S[0].x<0?at(S[0].y,S[1].y)?Math.abs(t.middleAngle){t.attribute.outerRadius>o&&(o=t.attribute.outerRadius)}));const l=this.computeLayoutOuterRadius(o,e.width,e.height),h=null!==(n=null==e?void 0:e.centerOffset)&&void 0!==n?n:0,c=this.computeRadius(l,e.width,e.height,h)+a,d=c-r;return Math.max((d**2+t**2)/(2*d),c)}_findNeighborIndex(t,e){const i=e.originIndex;let n=-1,s=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){n=e;break}for(let e=i+1;e{a.get(e)||this.removeChild(t)})),this._componentMap=a}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function aY(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 oY(t,e,i,n){let s="";if(!t||0===e.length)return s;const r=e[0],a=Ut.distancePP(t,r),o=i?0:1;return n?s+=`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?s=`M${t.x},${t.y}`:s+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),s}function lY(t,e,i){const{type:n,closed:s}=i,r=e.slice(0).reverse();let a="",o="";if("line"===n&&i.smoothLink&&i.center){const e=t[0],n=r[0],l=i.center;a=aY(t,!!s),o=aY(r,!!s);const h=Ut.distancePP(n,l),c=Ut.distancePP(e,l);a+=`A${h},${h},0,0,1,${n.x},${n.y}L${n.x},${n.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===n){const{center:e}=i;a=oY(e,t,!1,!!s),o=oY(e,r,!0,!!s)}else"line"!==n&&"polygon"!==n||(a=aY(t,!!s),o=aY(r,!!s));return s?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}rY.defaultAttributes={pickable:!1};class hY extends KG{constructor(t){super(D({},hY.defaultAttributes,t)),this.name="grid"}render(){this.removeAllChild();const{type:t,items:e,style:i,closed:n,alternateColor:s,depth:r=0}=this.attribute;if(!C(e)&&(e.forEach(((e,s)=>{const{id:a,points:l}=e;let h="";if("line"===t||"polygon"===t)h=aY(l,!!n);else if("circle"===t){const{center:t}=this.attribute;h=oY(t,l,!1,!!n)}const c=zO(Object.assign({path:h,z:r},o(i)?D({},hY.defaultAttributes.style,i(e,s)):i));c.name=`${this.name}-line`,c.id=this._getNodeId(`path-${a}`),this.add(c)})),r&&"line"===t&&e.forEach(((t,e)=>{const{id:s,points:a}=t,l=[];l.push(a[0]);const h=a[1].x-a[0].x,c=a[1].y-a[0].y,d=Math.sqrt(h*h+c*c),u=r/d;l.push({x:a[0].x+h*u,y:a[0].y+c*u});const p=aY(l,!!n),g=Et(l[0].x-l[1].x),f=Et(l[0].y-l[1].y),v=zO(Object.assign({path:p,z:0,alpha:g>f?(a[1].x-a[0].x>0?-1:1)*kt/2:0,beta:gf?[l[0].x,0]:[0,l[0].y]},o(i)?D({},hY.defaultAttributes.style,i(t,e)):i));v.name=`${this.name}-line`,v.id=this._getNodeId(`path-${s}`),this.add(v)})),e.length>1&&s)){const t=f(s)?s:[s,"transparent"],i=e=>t[e%t.length];for(let t=0;t1&&this.computeLineAngle();const a=this.renderSymbol(e,"start"),o=this.renderSymbol(i,"end");this.startSymbol=a,this.endSymbol=o;let l=t;if(null==e?void 0:e.visible){const i=(null==e?void 0:e.clip)?(null==e?void 0:e.size)||10:0;l=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...l.slice(1)]}if(null==i?void 0:i.visible){const e=(null==i?void 0:i.clip)?(null==i?void 0: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)};l=[...l.slice(0,l.length-1),n]}const h=jO(Object.assign({points:l,fill:!1},n));h.name="line",h.id=this._getNodeId("line"),C(null==s?void 0:s.line)||(h.states=s.line),this.line=h,this.add(h)}renderSymbol(t,e){const{autoRotate:i=!0}=t;let n;if(null==t?void 0:t.visible){const s=this._startAngle,r=this._endAngle,{points:a,state:o}=this.attribute,l=a[0],h=a[a.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let v,m;"start"===e?(v={x:l.x+(s?c*Math.cos(s)+d*Math.cos(s-Math.PI/2):0),y:l.y+(s?c*Math.sin(s)+d*Math.sin(s-Math.PI/2):0)},m=s+Math.PI/2):(v={x:h.x+(r?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:h.y+(r?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},m=r+Math.PI/2),n=WO(Object.assign(Object.assign(Object.assign({},v),{symbolType:g,size:f,angle:i?m+u:0,strokeBoundsBuffer:0}),p)),n.name=`${e}-symbol`,n.id=this._getNodeId(`${e}-symbol`),C(null==o?void 0:o.symbol)||(n.states=o.symbol),this.add(n)}return n}getStartAngle(){return this._startAngle}getEndAngle(){return this._endAngle}}var dY,uY;cY.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"}(dY||(dY={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(uY||(uY={}));const pY={[uY.selectedReverse]:{},[uY.selected]:{},[uY.hover]:{},[uY.hoverReverse]:{}},gY={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}},grid:{style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}};var fY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s{const e=t.target;e!==this._lastHover&&e.name&&!C(e.states)&&(e.addState(dU.hover,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.hoverReverse),t.removeState(dU.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState(dU.selected))return this._lastSelect=null,void ZG(this.axisContainer,(t=>{t.name&&!C(t.states)&&(t.removeState(dU.selectedReverse),t.removeState(dU.selected))}));e.name&&!C(e.states)&&(e.addState(dU.selected,!0),ZG(this.axisContainer,(t=>{t!==e&&t.name&&!C(t.states)&&t.addState(dU.selectedReverse,!0)})),this._lastSelect=e)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=R(this.attribute);D(this.attribute,t);const i=FO({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.removeAllChild(),this._prevInnerView=this._innerView,this._innerView=FO({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent()}_bindEvent(){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:n,line:s,grid:r,items:a}=this.attribute,o=FO({x:0,y:0,zIndex:1});if(o.name=dY.axisContainer,o.id=this._getNodeId("container"),o.setMode(this.mode),this.axisContainer=o,t.add(o),(null==s?void 0:s.visible)&&this.renderLine(o),a&&a.length){if(this.data=this._transformItems(a[0]),(null==n?void 0:n.visible)&&this.renderTicks(o),null==i?void 0:i.visible){const t=FO({x:0,y:0,pickable:!1});t.name=dY.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,o.add(t),a.forEach(((e,i)=>{const n=this.renderLabels(t,e,i),s=n.getChildren();this.beforeLabelsOverlap(s,e,n,i,a.length),this.handleLabelsOverlap(s,e,n,i,a.length),this.afterLabelsOverlap(s,e,n,i,a.length)}))}(null==r?void 0:r.visible)&&this.renderGrid(t)}(null==e?void 0:e.visible)&&this.renderTitle(o)}renderTicks(t){const e=this.getTickLineItems(),i=FO({x:0,y:0,pickable:!1});i.name=dY.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,n)=>{var s;const r=jO(Object.assign({},this._getTickLineAttribute("tick",t,n,e)));if(r.name=dY.tick,r.id=this._getNodeId(t.id),C(null===(s=this.attribute.tick)||void 0===s?void 0:s.state))r.states=uU;else{const t=this.data[n],e=D({},uU,this.attribute.tick.state);Object.keys(e).forEach((i=>{o(e[i])&&(e[i]=e[i](t.rawValue,n,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:n}=this.attribute;if(null==n?void 0:n.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,s)=>{const r=jO(Object.assign({},this._getTickLineAttribute("subTick",t,s,e)));if(r.name=dY.subTick,r.id=this._getNodeId(`${s}`),C(n.state))r.states=uU;else{const i=D({},uU,n.state);Object.keys(i).forEach((n=>{o(i[n])&&(i[n]=i[n](t.value,s,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:n}=this.attribute.label;n&&o(n)&&(e=n(e,i));const s=this._transformItems(e),r=FO({x:0,y:0,pickable:!1});r.name=`${dY.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r);let a=0,l=0,h="center",c="middle";return s.forEach(((t,e)=>{var n,d;const u=this._getLabelAttribute(t,e,s,i),p=VO(u);if(p.name=dY.label,p.id=this._getNodeId(`layer${i}-label-${t.id}`),C(null===(n=this.attribute.label)||void 0===n?void 0:n.state))p.states=uU;else{const n=D({},uU,this.attribute.label.state);Object.keys(n).forEach((r=>{o(n[r])&&(n[r]=n[r](t,e,s,i))})),p.states=n}r.add(p);const g=null!==(d=u.angle)&&void 0!==d?d:0;a=Math.max(a,p.AABBBounds.width()),l=Math.max(l,p.AABBBounds.height()),g&&(a=Math.abs(a*Math.cos(g)),l=Math.abs(l*Math.sin(g))),h=u.textAlign,c=u.textBaseline})),this.axisLabelLayerSize[i]={width:a,height:l,textAlign:h,textBaseline:c},r}renderTitle(t){const e=this.getTitleAttribute(),i=new vU(Object.assign({},e));i.name=dY.title,i.id=this._getNodeId("title"),t.add(i)}renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType("subGrid",t),this._renderGridByType("grid",t)}getVerticalCoord(t,e,i){const n=this.getVerticalVector(e,i,t);return{x:t.x+n[0],y:t.y+n[1]}}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}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:n,inside:s=!1,length:r,dataFilter:a}=t;let l=1;return e.length>=2&&(l=e[1].value-e[0].value),(a&&o(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!n){const i=t.value-l/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const o=this.getVerticalCoord(e,r,s);if("3d"===this.mode){const n=this.getVerticalVector(r,s,e);let l=0,h=0;Et(n[0])>Et(n[1])?l=kt/2*(o.x>e.x?1:-1):h=kt/2*(o.y>e.y?-1:1),i.push({start:e,end:o,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:l,beta:h})}else i.push({start:e,end:o,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:n=!1,length:s=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===y[1]?v+=(this.axisLabelLayerSize[n-1].height+T(this.attribute,"label.space",4))*n:v+=(this.axisLabelLayerSize[n-1].width+T(this.attribute,"label.space",4))*n);const _=this.getVerticalCoord(t.point,v,p),b=this.getVerticalVector(v,p,_),x=g?g(`${t.label}`,t,e,i,n):t.label;let{style:S}=f;S=o(S)?D({},gY.label.style,S(t,e,i,n)):S;return S=D(this.getLabelAlign(b,p,S.angle),S),o(S.text)&&(S.text=S.text({label:t.label,value:t.rawValue,index:t.index,layer:n})),Object.assign(Object.assign(Object.assign({},_),{text:x,lineHeight:null==S?void 0:S.fontSize}),S)}_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}_renderGridByType(t,e){const i=this.getGridAttribute(t),n=new hY(Object.assign(Object.assign({pickable:!1},i),{zIndex:0}));n.name="subGrid"===t?`${dY.grid}-sub`:`${dY.grid}`,n.id=this._getNodeId(t),e.add(n)}}const mY={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,n)=>n&&yY(i.AABBBounds,t.AABBBounds,e)?t.setAttribute("opacity",0):(i=t,1)))}};function yY(t,e,i){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function _Y(t,e){for(let i,n=1,s=t.length,r=t[0].AABBBounds;n1&&e.height()>1}function xY(t){for(let n=1;n2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;const s=Ie(t,i),r=Ie(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];n&&(n.save(),n.fillStyle="red",n.globalAlpha=.6,s.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore(),n.save(),n.fillStyle="green",n.globalAlpha=.6,r.forEach(((t,e)=>{0===e?n.moveTo(t.x,t.y):n.lineTo(t.x,t.y)})),n.fill(),n.restore());const o=Be(t),l=Be(e);n&&n.fillRect(o.x,o.y,2,2),n&&n.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(s[0],s[1]),d=a(s[1],s[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?t.angle:Oe(t.angle);let f=i?t.angle+Mt:Oe(90-t.angle);const v=i?e.angle:Oe(e.angle);let m=i?e.angle+Mt:Oe(90-e.angle);f>Tt&&(f-=Tt),m>Tt&&(m-=Tt);const y=(t,e,i,n)=>{const s=[Math.cos(e),Math.sin(e)];return t+(Pe(s,i)+Pe(s,n))/2>Pe(s,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,v,c,d)&&y((e.y2-e.y1)/2,m,c,d)}(e.rotatedBounds,i.rotatedBounds,!0))return!0;var e,i;return!1}function SY(t,e){"bottom"!==t&&"top"!==t||function(t,e){e.forEach((e=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},AY(t,e.attribute.angle)),{angle:wY(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({},kY(t,e.attribute.angle)),{angle:wY(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{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=(r=e.centerX,a=e.centerY,o=e.angle,l=t.attribute.x,h=t.attribute.y,{x:(r-l)*Math.cos(o)+(a-h)*Math.sin(o)+l,y:(r-l)*Math.sin(o)+(h-a)*Math.cos(o)+h}),n=i.x-e.centerX,s=i.y-e.centerY;var r,a,o,l,h;e.x1+=n,e.x2+=n,e.y1+=s,e.y2+=s,e.centerX+=n,e.centerY+=s,t.rotatedBounds=e}))}(e)}function wY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function AY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],n=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],n=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}function kY(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","center","left","center","right","right"],n=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","right","right","right","left","left","left","left","right"],n=["middle","bottom","middle","top","top","top","middle","bottom","bottom"]);const s=(e=wY(e))/(.5*Math.PI);let r;return r=s===Math.floor(s)?2*Math.floor(s):2*Math.floor(s)+1,{textAlign:i[r],textBaseline:n[r]}}var MY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(){const{start:t,end:e}=this.attribute;return[e.x-t.x,e.y-t.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,n=function(t){const[e,i]=t;let n=e*e+i*i;return n>0&&(n=1/Math.sqrt(n)),[t[0]*n,t[1]*n]}(this.getRelativeVector());return aU([n[1],-1*n[0]],t*(e?1:-1)*i)}getTitleAttribute(){var t,e,i,n,s,r,a,o;const h=this.attribute.title,{position:c="middle",space:d=4,textStyle:u={},autoRotate:p=!0,shape:g,background:f,state:v}=h,m=MY(h,["position","space","textStyle","autoRotate","shape","background","state"]);let y=.5;"start"===c?y=0:"end"===c&&(y=1);const{verticalFactor:_=1}=this.attribute,b=-1*_,x=this.getTickCoord(y),S=this.getRelativeVector();let w=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)){const t=+T(this.attribute,"label.space",4);w+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===S[1]){const i=this.axisLabelsContainer.AABBBounds.height();isFinite(i)?w+=i+(e-1)*t:w=0}else{if(0===S[0]){const i=this.axisLabelsContainer.AABBBounds.width();isFinite(i)?w+=i+(e-1)*t:w=0}else Object.keys(this.axisLabelLayerSize).forEach(((e,i)=>{w+=this.axisLabelLayerSize[e].width+(i>0?t:0)}));const i=this.axisLabelLayerSize[0].textAlign,n="start"===i||"left"===i,s="center"===i,r=S[1]>0;w=1===b?r?n?w:s?w/2:t:n?t:s?w/2:w:r?n?t:s?w/2:w:n?w:s?w/2:t}}let A=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(A=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(A=Math.max(A,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const k=A+w+d,M=this.getVerticalCoord(x,k,!1),C=this.getVerticalVector(k,!1);let E,P,{angle:R}=m;if(E="start"===c?"start":"end"===c?"end":"center",l(R)&&p){R=oU(S,[1,0],!0);const{verticalFactor:t=1}=this.attribute;P=1==-1*t?"bottom":"top"}else E=this.getTextAlign(C),P=this.getTextBaseline(C,!1);const O=Object.assign(Object.assign(Object.assign({},M),m),{textStyle:Object.assign({textAlign:E,textBaseline:P},u),state:{text:D({},pY,null==v?void 0:v.text),shape:D({},pY,null==v?void 0:v.shape),panel:D({},pY,null==v?void 0:v.background)}});return O.angle=R,g&&g.visible&&(O.shape=Object.assign({visible:!0},g.style),g.space&&(O.space=g.space)),f&&f.visible&&(O.panel=Object.assign({visible:!0},f.style)),O}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute.grid;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:n,startAngle:s=lU,endAngle:r=hU}=this.attribute.grid;i=function(t,e,i,n,s){const r=[],a=s-n;for(let s=0;s=2&&(s=this.data[1].value-this.data[0].value);let r=[];if("grid"===t){n=this.attribute.grid;const t=[];this.data.forEach((n=>{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}else{n=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:a=4}=this.attribute.subTick||{};if(this.data.length>=2){const n=[];this.data.forEach((t=>{let e=t.value;if(!i){const i=t.value-s/2;if(this.isInValidValue(i))return;e=i}n.push({value:e})}));for(let i=0;i0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const n=this.attribute.orient;if(_(i)){if("top"===n||"bottom"===n)return AY(n,i);if("left"===n||"right"===n)return kY(n,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,n,s){const{flush:r=!1}=this.attribute.label||{};if(r){const{orient:e,start:i,end:n}=this.attribute,s="bottom"===e||"top"===e,r=t[0],a=W(t),o=s?r.attribute.x>a.attribute.x:r.attribute.ye&&r.setAttributes({x:e,textAlign:"right"}),si&&a.setAttributes({x:i,textAlign:"right"})}}else{const t=Math.abs(i.y-n.y);if(o){const e=r.AABBBounds.y1,i=a.AABBBounds.y2,n=0,s=t;es&&a.setAttributes({y:s,textBaseline:"bottom"})}else{const e=t,i=0,n=r.AABBBounds.y2,s=a.AABBBounds.y1;n>e&&r.setAttributes({y:e,textBaseline:"bottom"}),s!!t.attribute.angle)))return;let s=0,r=0;for(n&&n.length>0&&(r=n.length);s{t.attribute.angle=Kt(e)})),SY(i,t),!xY(t))break}}(t,{labelRotateAngle:p,orient:h}),g&&_(c)&&c>0&&function(t,e){const{limitLength:i,ellipsis:n="...",orient:s}=e;!C(t)&&_(i)&&t.forEach((t=>{if(("top"===s||"bottom"===s)&&Math.floor(t.AABBBounds.height())<=i)return;if(("left"===s||"right"===s)&&Math.floor(t.AABBBounds.width())<=i)return;let e=0===t.attribute.angle||l(t.attribute.angle)?"top"===s||"bottom"===s?null:i:Math.abs(i/Math.sin(t.attribute.angle));_(t.attribute.maxLineWidth)&&(e=_(e)?Math.min(t.attribute.maxLineWidth,e):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:e,ellipsis:t.attribute.ellipsis||n})}))}(t,{limitLength:c,ellipsis:f,orient:h}),v&&function(t,e){if(C(t))return;const i=t.filter(bY);if(C(i))return;let n;n=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:s="parity",separation:r=0}=e,a=o(s)?s:mY[s]||mY.parity;if(n.length>=3&&_Y(n,r)){do{n=a(n,r)}while(n.length>=3&&_Y(n,r));n.length<3&&!W(i).attribute.opacity&&(n.length>1&&W(n).setAttribute("opacity",0),W(i).setAttribute("opacity",1))}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:h,method:m,separation:y}))}afterLabelsOverlap(t,e,i,n,s){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let c=o?l.height():l.width();const{verticalMinSize:d}=this.attribute;if(_(d)&&(!_(r)||d<=r)){const t=this._getAxisLabelLimitLength(d,s);let e,n;c=Math.max(c,t),"left"===a?(e=l.x2-c,n=l.y1):"right"===a?(e=l.x1,n=l.y1):"top"===a?(e=l.x1,n=l.y2-c):"bottom"===a&&(e=l.x1,n=l.y1);const r=HO({x:e,y:n,width:o?l.width():c,height:o?c:l.height(),pickable:!1});r.name=dY.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(h(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2:"right"===a?e=l.x1:"top"===a?e=l.y2:"bottom"===a&&(e=l.y1),function(t,e,i,n,s){if("right"===n||"left"===n){if("left"===s){const s="right"===n?0:-1;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"left"})}))}else if("right"===s){const s="right"===n?1:0;t.forEach((t=>{t.setAttributes({x:e+i*s,textAlign:"right"})}))}else if("center"===s){const s="right"===n?1:-1;t.forEach((t=>{t.setAttributes({x:e+.5*i*s,textAlign:"center"})}))}}else if("bottom"===n||"top"===n)if("top"===s){const s="bottom"===n?0:-1;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"top"})}))}else if("bottom"===s){const s="bottom"===n?1:0;t.forEach((t=>{t.setAttributes({y:e+i*s,textBaseline:"bottom"})}))}else if("middle"===s){const s="bottom"===n?1:-1;t.forEach((t=>{t.setAttributes({y:e+.5*i*s,textBaseline:"middle"})}))}}(t,e,c,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,n,s;const{label:r,title:a,line:o,tick:l}=this.attribute,h=null!==(i=r.space)&&void 0!==i?i:4;let c=t,d=0,u=0;const p=(null==o?void 0:o.visible)?null!==(n=o.style.lineWidth)&&void 0!==n?n:1:0,g=(null==l?void 0:l.visible)?null!==(s=l.length)&&void 0!==s?s:4:0;if(null==a?void 0:a.visible){d=gU(a.text,a.textStyle).height;const t=Ze(a.padding);u=a.space+t[0]+t[2]}return c&&(c=(c-h-u-d-p-g)/e),c}}CY.defaultAttributes=gY;var TY,EY=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(t);s0&&(l=r,h=0);const c=LO(Object.assign(Object.assign(Object.assign({},s),{startAngle:e,endAngle:i,radius:l,innerRadius:h}),null==a?void 0:a.style));c.name=dY.line,c.id=this._getNodeId("line"),C(null==a?void 0:a.state)||(c.states=D({},pY,a.state)),t.add(c)}isInValidValue(t){const{startAngle:e=lU,endAngle:i=hU}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=lU,endAngle:i=hU,center:n,radius:s,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(n,r&&a>0?a:s,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const{inside:n=!1}=this.attribute,{center:s}=this.attribute,r=[i.x-s.x,i.y-s.y];return aU(r,(e?-1:1)*(n?-1:1)*t/function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(r))}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}getTitleAttribute(){var t,e,i,n,s,r,a,o;const{center:h,radius:c,innerRadius:d=0}=this.attribute,u=this.attribute.title,{space:p=4,textStyle:g={},shape:f,background:v,state:m}=u,y=EY(u,["space","textStyle","shape","background","state"]);let _=h,b=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===(null===(e=this.attribute.label)||void 0===e?void 0:e.inside)&&(b=T(this.attribute.label,"style.fontSize",12)+T(this.attribute.label,"space",4));let x=0;(null===(i=this.attribute.tick)||void 0===i?void 0:i.visible)&&!1===(null===(n=this.attribute.tick)||void 0===n?void 0:n.inside)&&(x=(null===(s=this.attribute.tick)||void 0===s?void 0:s.length)||4),(null===(r=this.attribute.subTick)||void 0===r?void 0:r.visible)&&!1===(null===(a=this.attribute.subTick)||void 0===a?void 0:a.inside)&&(x=Math.max(x,(null===(o=this.attribute.subTick)||void 0===o?void 0:o.length)||2));const S=c+x+b+p;let w="middle",{position:A}=this.attribute.title;l(A)&&(A=0===d?"end":"middle"),"start"===A?(w="bottom",_={x:h.x,y:h.y-S}):"end"===A&&(w="top",_={x:h.x,y:h.y+S});const k=Object.assign(Object.assign(Object.assign({},_),y),{textStyle:Object.assign({textBaseline:w,textAlign:"center"},g),state:{text:D({},pY,null==m?void 0:m.text),shape:D({},pY,null==m?void 0:m.shape),panel:D({},pY,null==m?void 0:m.background)}}),{angle:M}=y;return k.angle=M,f&&f.visible&&(k.shape=Object.assign({visible:!0},f.style),f.space&&(k.space=f.space)),v&&v.visible&&(k.panel=Object.assign({visible:!0},v.style)),k}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,n=[],{count:s=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=2&&(d=this.data[1].value-this.data[0].value),"grid"===t){e=this.attribute.grid;const t=[];let n;n=Math.abs(a-r)%(2*Math.PI)==0?[...this.data].concat(this.data[0]):this.data,n.forEach((e=>{let{point:i}=e;if(!h){const t=e.value-d/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const n=this.getVerticalCoord(i,c,!0);t.push({id:e.id,points:[i,n],datum:e})})),i=t}else{e=D({},this.attribute.grid,this.attribute.subGrid);const t=[],{count:n=4}=this.attribute.subTick||{},s=this.data.length;if(s>=2){const e=[];this.data.forEach((t=>{let i=t.value;if(!h){const e=t.value-d/2;if(this.isInValidValue(e))return;i=e}e.push({value:i})}));for(let i=0;i0&&t[1]>Math.abs(t[0])?e="top":t[1]<0&&Math.abs(t[1])>Math.abs(t[0])&&(e="bottom"),e}beforeLabelsOverlap(t,e,i,n,s){}handleLabelsOverlap(t,e,i,n,s){}afterLabelsOverlap(t,e,i,n,s){}getLabelAlign(t,e,i){return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t)}}}PY.defaultAttributes=gY;class RY extends HC{constructor(){super(...arguments),this.mode=qA.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._oldElementMap=function(t){const e={};return ZG(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}(e),this._newElementAttrMap={},ZG(t,(t=>{var e,i,n,s,r,a;if("group"!==t.type&&t.id){const o=this._oldElementMap[t.id];if(o){if(!z(t.attribute,o.attribute)){const s=R(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},s),{opacity:null!==(e=s.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(n=s.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(o.attribute)}}else{const e={opacity:null!==(s=t.attribute.opacity)&&void 0!==s?s:1,fillOpacity:null!==(r=t.attribute.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(a=t.attribute.strokeOpacity)&&void 0!==a?a:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;Object.keys(this._newElementAttrMap).forEach((i=>{var n,s,r;const{node:a,attrs:o,state:l}=this._newElementAttrMap[i];"enter"===l&&(t=_(null===(n=this.params.enter)||void 0===n?void 0:n.duration)?this.params.enter.duration:t,e=(null===(s=this.params.enter)||void 0===s?void 0:s.easing)?null===(r=this.params.enter)||void 0===r?void 0:r.easing:e),"path"===a.type?a.animate({interpolate:(t,e,i,n,s)=>"path"===t&&(s.path=function(t,e){let i,n,s,r=bt.lastIndex=xt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=bt.exec(t))&&(n=xt.exec(e));)(s=n.index)>r&&(s=e.slice(r,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(n=n[0])?o[a]?o[a]+=n:o[++a]=n:(o[++a]=null,l.push({i:a,x:yt(i,n)})),r=xt.lastIndex;return rt,this._onHandlerPointerDown=(t,e)=>{"start"===e?(this._activeTag=TY.startHandler,this._activeItem=this._startHandler):"end"===e?(this._activeTag=TY.endHandler,this._activeItem=this._endHandler):"middleRect"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=TY.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=TY.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t)},this._onHandlerPointerMove=t=>{const{start:e,end:i,brushSelect:n}=this.attribute,s=this.eventPosToStagePos(t),{attPos:r,max:a}=this._layoutCache,o=(s[r]-this._activeCache.lastPos[r])/a;this._activeState&&(this._activeTag===TY.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+o):this._activeTag===TY.startHandler?this.state.start+o>this.state.end?(this.state.start=this.state.end,this.state.end=this.state.start+o,this._activeTag=TY.endHandler):this.state.start=this.state.start+o:this._activeTag===TY.endHandler&&(this.state.end+othis._onHandlerPointerDown(t,"start"))),this._endHandler&&this._endHandler.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))),"browser"===XH.env&&(XH.addEventListener("pointermove",this._onHandlerPointerMove.bind(this)),XH.addEventListener("pointerup",this._onHandlerPointerUp.bind(this))),this.addEventListener("pointermove",this._onHandlerPointerMove),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}eventPosToStagePos(t){var e,i,n;const s=null===(e=this.stage)||void 0===e?void 0:e.window.getBoundingClientRect();return{x:t.clientX-((null==s?void 0:s.left)||0)-((null===(i=this.stage)||void 0===i?void 0:i.x)||0),y:t.clientY-((null==s?void 0:s.top)||0)-((null===(n=this.stage)||void 0===n?void 0:n.y)||0)}}_onHandlerPointerUp(t){const{start:e,end:i,brushSelect:n}=this.attribute;if(this._activeState&&this._activeTag===TY.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,n&&this.renderDragMask(),e===this.state.start&&i===this.state.end||(this.setAttributes({start:this.state.start,end:this.state.end}),this._updateStateCallback&&this._updateStateCallback(this.state.start,this.state.end))}_onHandlerPointerEnter(t){this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:n}=this._layoutCache,{position:s}=this.attribute,r=t[i]-s[i],a=e[i]-s[i],o=Math.min(Math.max(Math.min(r,a)/n,0),1),l=Math.min(Math.max(Math.max(r,a)/n,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):(this.state.start=o,this.state.end=l)}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.state.start=this.state.start+e,this.state.end=this.state.end+e)}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ut(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0,height:n},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ut(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+n),width:i,height:this._activeState&&this._activeTag===TY.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}renderText(){const{startTextStyle:t,endTextStyle:e}=this.attribute,{formatMethod:i}=t,n=BY(t,["formatMethod"]),{formatMethod:s}=e,r=BY(e,["formatMethod"]),{start:a,end:o}=this.state;this._startValue=this._statePointToData(a),this._endValue=this._statePointToData(o);const{position:l,width:h,height:c}=this.getLayoutAttrFromConfig();this._isHorizontal?(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+a*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"right",textBaseline:"middle"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+o*h,y:l.y+c/2,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"left",textBaseline:"middle"}}),`data-zoom-end-text-${l}`)):(this._startText=this.maybeAddLabel(this._container,D({},n,{text:i?i(this._startValue):this._startValue,x:l.x+h/2,y:l.y+a*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"bottom"}}),`data-zoom-start-text-${l}`),this._endText=this.maybeAddLabel(this._container,D({},r,{text:s?s(this._endValue):this._endValue,x:l.x+h/2,y:l.y+o*c,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:{textAlign:"center",textBaseline:"top"}}),`data-zoom-end-text-${l}`))}getLayoutAttrFromConfig(){var t,e,i,n;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:s,size:r,orient:a,middleHandlerStyle:o,startHandlerStyle:l,endHandlerStyle:h}=this.attribute,{width:c,height:d}=r,u=null!==(e=null===(t=null==o?void 0:o.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let p,g,f;(null==o?void 0:o.visible)?this._isHorizontal?(p=c,g=d-u,f={x:s.x,y:s.y+u}):(p=c-u,g=d,f={x:s.x+("left"===a?u:0),y:s.y}):(p=c,g=d,f=s);const v=null!==(i=null==l?void 0:l.size)&&void 0!==i?i:this._isHorizontal?g:p,m=null!==(n=null==h?void 0:h.size)&&void 0!==n?n:this._isHorizontal?g:p;return(null==l?void 0:l.visible)&&(this._isHorizontal?(p-=(v+m)/2,f={x:f.x+v/2,y:f.y}):(g-=(v+m)/2,f={x:f.x,y:f.y+v})),this._layoutAttrFromConfig={position:f,width:p,height:g},this._layoutAttrFromConfig}render(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b;this._layoutAttrFromConfig=null;const{orient:x,backgroundStyle:S,backgroundChartStyle:w,selectedBackgroundStyle:A,selectedBackgroundChartStyle:k,middleHandlerStyle:M,startHandlerStyle:C,endHandlerStyle:T,brushSelect:E}=this.attribute,{start:P,end:R}=this.state,{position:O,width:B,height:I}=this.getLayoutAttrFromConfig(),D=this.createOrUpdateChild("dataZoom-container",{},"group");this._container=D,this._background=D.createOrUpdateChild("background",Object.assign({x:O.x,y:O.y,width:B,height:I,cursor:E?"crosshair":"auto"},S),"rect"),(null===(t=null==w?void 0:w.line)||void 0===t?void 0:t.visible)&&this.setPreviewAttributes("line",D),(null===(e=null==w?void 0:w.area)||void 0===e?void 0:e.visible)&&this.setPreviewAttributes("area",D),E&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x+P*B,y:O.y,width:(R-P)*B,height:I,cursor:E?"crosshair":"move"},A),"rect"):this._selectedBackground=D.createOrUpdateChild("selectedBackground",Object.assign({x:O.x,y:O.y+P*I,width:B,height:(R-P)*I,cursor:E?"crosshair":"move"},A),"rect"),(null===(i=null==k?void 0:k.line)||void 0===i?void 0:i.visible)&&this.setSelectedPreviewAttributes("line",D),(null===(n=null==k?void 0:k.area)||void 0===n?void 0:n.visible)&&this.setSelectedPreviewAttributes("area",D),this.renderText(),this._isHorizontal?(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+P*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(s=null==C?void 0:C.symbolType)&&void 0!==s?s:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},C),"symbol"),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+R*B,y:O.y+I/2,size:I,angle:0,symbolType:null!==(r=null==T?void 0:T.symbolType)&&void 0!==r?r:"square",cursor:"ew-resize",strokeBoundsBuffer:0,boundsPadding:2,pickMode:"imprecise"},T),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:O.x+P*B,y:O.y-((null===(a=null==M?void 0:M.background)||void 0===a?void 0:a.size)||10),width:(R-P)*B,height:(null===(o=null==M?void 0:M.background)||void 0===o?void 0:o.size)||10},null===(l=null==M?void 0:M.background)||void 0===l?void 0:l.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:O.x+(P+R)/2*B,y:O.y-((null===(h=null==M?void 0:M.background)||void 0===h?void 0:h.size)||10)/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(d=null===(c=null==M?void 0:M.icon)||void 0===c?void 0:c.symbolType)&&void 0!==d?d:"square"},null==M?void 0:M.icon),"symbol"))):(this._startHandler=D.createOrUpdateChild("startHandler",Object.assign({x:O.x+B/2,y:O.y+P*I,size:B,angle:Math.PI/180*90,symbolType:null!==(u=null==C?void 0:C.symbolType)&&void 0!==u?u:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},C),"symbol"),(null==M?void 0:M.visible)&&(this._middleHandlerRect=D.createOrUpdateChild("middleHandlerRect",Object.assign({x:"left"===x?O.x-((null===(p=null==M?void 0:M.background)||void 0===p?void 0:p.size)||10):O.x+B,y:O.y+P*I,width:(null===(g=null==M?void 0:M.background)||void 0===g?void 0:g.size)||10,height:(R-P)*I},null===(f=null==M?void 0:M.background)||void 0===f?void 0:f.style),"rect"),this._middleHandlerSymbol=D.createOrUpdateChild("middleHandlerSymbol",Object.assign({x:"left"===x?O.x-((null===(v=null==M?void 0:M.background)||void 0===v?void 0:v.size)||10)/2:O.x+B+((null===(m=null==M?void 0:M.background)||void 0===m?void 0:m.size)||10)/2,y:O.y+(P+R)/2*I,angle:Math.PI/180*90,symbolType:null!==(_=null===(y=null==M?void 0:M.icon)||void 0===y?void 0:y.symbolType)&&void 0!==_?_:"square",strokeBoundsBuffer:0},null==M?void 0:M.icon),"symbol")),this._endHandler=D.createOrUpdateChild("endHandler",Object.assign({x:O.x+B/2,y:O.y+R*I,size:B,angle:Math.PI/180*90,symbolType:null!==(b=null==T?void 0:T.symbolType)&&void 0!==b?b:"square",cursor:"ns-resize",boundsPadding:2,pickMode:"imprecise",strokeBoundsBuffer:0},T),"symbol"))}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:n}=this.getLayoutAttrFromConfig();let s,r;return this._isHorizontal?(s=[{x:e.x,y:e.y+n}],r=[{x:e.x+i,y:e.y+n}]):"left"===t?(s=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+n}]):(s=[{x:e.x,y:e.y+n}],r=[{x:e.x,y:e.y}]),{basePointStart:s,basePointEnd:r}}getPreviewLinePoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t)})));if(0===t.length)return t;const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){const t=this._previewData.map((t=>({x:this._previewCallbackX&&this._previewCallbackX(t),y:this._previewCallbackY&&this._previewCallbackY(t),x1:this._previewCallbackX1&&this._previewCallbackX1(t),y1:this._previewCallbackY1&&this._previewCallbackY1(t)})));if(0===t.length)return 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},null==i?void 0:i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0: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:n,end:s}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+n*a:r.x,y:this._isHorizontal?r.y:r.y+n*o,width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+n*a:r.x),y:-(this._isHorizontal?r.y:r.y+n*o),width:this._isHorizontal?(s-n)*a:a,height:this._isHorizontal?o:(s-n)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},null==i?void 0:i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},null==i?void 0:i.area))}maybeAddLabel(t,e,i){let n=this.find((t=>t.name===i),!0);return n?n.setAttributes(e):(n=new vU(e),n.name=i),t.add(n),n}setStartAndEnd(t,e){const{start:i,end:n}=this.attribute;h(t)&&h(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&n===this.state.end||(this.setAttributes({start:t,end:e}),this._updateStateCallback&&this._updateStateCallback(t,e)))}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,n;const{middleHandlerStyle:s}=this.attribute,r=null!==(e=null===(t=null==s?void 0:s.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(n=null===(i=null==s?void 0:s.icon)||void 0===i?void 0:i.size)&&void 0!==n?n:10;return Math.max(r,...V(a))}setUpdateStateCallback(t){o(t)&&(this._updateStateCallback=t)}setPreviewCallbackX(t){o(t)&&(this._previewCallbackX=t)}setPreviewCallbackY(t){o(t)&&(this._previewCallbackY=t)}setPreviewCallbackX1(t){o(t)&&(this._previewCallbackX1=t)}setPreviewCallbackY1(t){o(t)&&(this._previewCallbackY1=t)}setStatePointToData(t){o(t)&&(this._statePointToData=t)}};var DY,LY,FY;IY.defaultAttributes={orient:"bottom",showDetail:"auto",brushSelect:!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,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,symbolType:"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",fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},function(t){t.start="start",t.middle="middle",t.end="end",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(DY||(DY={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom"}(LY||(LY={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(FY||(FY={}));class jY extends KG{_initContainer(){var t,e,i,n,s,r,a,o,l;const c=FO(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i}));c.name="marker-container";const d=FO({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)});c.add(d),this._containerClip=c,this.add(c),this._container=d}_updateContainer(){var t,e,i,n,s,r,a,o,l;this._containerClip.setAttributes(Object.assign(Object.assign({},null===(t=this.attribute)||void 0===t?void 0:t.clipRange),{clip:null!==(i=h(null===(e=this.attribute)||void 0===e?void 0:e.clipRange))&&void 0!==i&&i})),this._container.setAttributes({x:-(null!==(r=null===(s=null===(n=this.attribute)||void 0===n?void 0:n.clipRange)||void 0===s?void 0:s.x)&&void 0!==r?r:0),y:-(null!==(l=null===(o=null===(a=this.attribute)||void 0===a?void 0:a.clipRange)||void 0===o?void 0:o.y)&&void 0!==l?l:0)})}render(){var t,e;const i=null===(t=this.attribute.visible)||void 0===t||t;null!==(e=this.attribute.interactive)&&void 0!==e&&e||(this.setAttribute("pickable",!1),this.setAttribute("childrenPickable",!1)),i&&(this._containerClip?(this._updateContainer(),this.updateMarker()):(this._initContainer(),this.initMarker(this._container)))}}const zY={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:DY.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]}},HY={start:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"left",textBaseline:"bottom"},insideStartBottom:{textAlign:"left",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},NY={label:{position:LY.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}},VY={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"}},WY={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"}};let GY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){var t,e,i,n,s;const{points:r,label:a}=this.attribute,o=null!==(t=null==a?void 0:a.position)&&void 0!==t?t:"end",l=this._line.getEndAngle(),h=(null==a?void 0:a.refX)*Math.cos(l)+a.refY*Math.cos(l-Math.PI/2),c=(null==a?void 0:a.refX)*Math.sin(l)+a.refY*Math.sin(l-Math.PI/2);o.includes("start")||o.includes("Start")?null===(e=this._label)||void 0===e||e.setAttributes({x:r[0].x+h,y:r[0].y+c}):o.includes("middle")||o.includes("Middle")?null===(i=this._label)||void 0===i||i.setAttributes({x:(r[0].x+r[r.length-1].x)/2+h,y:(r[0].y+r[r.length-1].y)/2+c}):null===(n=this._label)||void 0===n||n.setAttributes({x:r[r.length-1].x+h,y:r[r.length-1].y+c}),this._label.setAttributes({angle:a.autoRotate&&l+(null!==(s=null==a?void 0:a.refAngle)&&void 0!==s?s:0),textStyle:Object.assign(Object.assign({},HY[o]),a.textStyle)})}initMarker(t){const{points:e,startSymbol:i,endSymbol:n,label:s,lineStyle:r}=this.attribute,a=new cY({points:e,startSymbol:i,endSymbol:n,lineStyle:r});a.name="mark-line-line",this._line=a,t.add(a);const o=new vU(Object.assign({},s));o.name="mark-line-label",this._label=o,t.add(o),this.setLabelPos()}updateMarker(){var t,e;const{points:i,startSymbol:n,endSymbol:s,label:r,lineStyle:a}=this.attribute;null===(t=this._line)||void 0===t||t.setAttributes({points:i,startSymbol:n,endSymbol:s,lineStyle:a}),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},r)),this.setLabelPos()}};GY.defaultAttributes=zY;let UY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}getLeftPos(){return{x:this._area.AABBBounds.x1,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getRightPos(){return{x:this._area.AABBBounds.x2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}getTopPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y1}}getBottomPos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:this._area.AABBBounds.y2}}getMiddlePos(){return{x:(this._area.AABBBounds.x1+this._area.AABBBounds.x2)/2,y:(this._area.AABBBounds.y1+this._area.AABBBounds.y2)/2}}setLabelPos(){var t,e,i,n,s,r,a;const{label:o}=this.attribute,l=null!==(t=null==o?void 0:o.position)&&void 0!==t?t:"middle";l.includes("left")||l.includes("Left")?null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},this.getLeftPos())):l.includes("right")||l.includes("Right")?null===(i=this._label)||void 0===i||i.setAttributes(Object.assign({},this.getRightPos())):l.includes("top")||l.includes("Top")?null===(n=this._label)||void 0===n||n.setAttributes(Object.assign({},this.getTopPos())):l.includes("bottom")||l.includes("Bottom")?null===(s=this._label)||void 0===s||s.setAttributes(Object.assign({},this.getBottomPos())):null===(r=this._label)||void 0===r||r.setAttributes(Object.assign({},this.getMiddlePos())),null===(a=this._label)||void 0===a||a.setAttributes({textStyle:Object.assign(Object.assign({},VY[l]),o.textStyle)})}initMarker(t){const{points:e,label:i,areaStyle:n}=this.attribute,s=UO(Object.assign({points:e},n));s.name="mark-area-area",this._area=s,t.add(s);const r=new vU(Object.assign({},i));r.name="mark-area-label",this._label=r,t.add(r),this.setLabelPos()}updateMarker(){var t,e;const{points:i,label:n,areaStyle:s}=this.attribute;null===(t=this._area)||void 0===t||t.setAttributes(Object.assign({points:i},s)),null===(e=this._label)||void 0===e||e.setAttributes(Object.assign({},n)),this.setLabelPos()}};UY.defaultAttributes=NY;let YY=class t extends jY{constructor(e){super(D({},t.defaultAttributes,e))}setLabelPos(){}setItemAttributes(t,e,i,n){var s;const{autoRotate:r=!0,refX:a=0,refY:o=0,refAngle:l=0,textStyle:h,richTextStyle:c,imageStyle:d,position:u=FY.middle}=e,p=(null===(s=this._line)||void 0===s?void 0:s.getEndAngle())||0,g=a*Math.cos(p)+o*Math.cos(p-Math.PI/2),f=a*Math.sin(p)+o*Math.sin(p-Math.PI/2);"text"===n?null==t||t.setAttributes(Object.assign(Object.assign({},h),{textStyle:Object.assign(Object.assign({},WY[(null==e?void 0:e.position)||"end"]),null==h?void 0:h.textStyle)})):"richText"===n?null==t||t.setAttributes({dx:this.getItemDx(t,u,c)+((null==c?void 0:c.dx)||0),dy:this.getItemDy(t,u,c)+((null==c?void 0:c.dy)||0)}):"image"===n&&(null==t||t.setAttributes({dx:this.getItemDx(t,u,d)+((null==d?void 0:d.dx)||0),dy:this.getItemDy(t,u,d)+((null==d?void 0:d.dy)||0)})),null==t||t.setAttributes({x:i.x+(g||0),y:i.y+(f||0),angle:r&&p+l})}getItemDx(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.width())&&void 0!==s?s:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var n,s;const r=null!==(s=null===(n=null==t?void 0:t.AABBBounds)||void 0===n?void 0:n.height())&&void 0!==s?s:(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){const{type:i="text",symbolStyle:n,richTextStyle:s,imageStyle:r,renderCustomCallback:a}=t;let o;return"symbol"===i?o=WO(Object.assign(Object.assign({},e),n)):"text"===i?o=new vU(Object.assign({},e)):"richText"===i?o=YO(Object.assign(Object.assign({},e),s)):"image"===i?o=GO(Object.assign(Object.assign({},e),r)):"custom"===i&&a&&(o=a()),this.setItemAttributes(o,t,e,i),o}getItemLineAttr(t,e,i){let n=[];const{type:s="type-s"}=t;return n="type-do"===s?[e,{x:(e.x+i.x)/2,y:i.y},i]:"type-po"===s?[e,{x:i.x,y:e.y},i]:"type-op"===s?[e,{x:e.x,y:i.y},i]:[e,i],n}setItemLineAttr(t,e,i,n){var s;const{startSymbol:r,endSymbol:a,lineStyle:o}=t,l=this.getItemLineAttr(t,e,i);null===(s=this._line)||void 0===s||s.setAttributes({points:l,startSymbol:r,endSymbol:a,lineStyle:o,visible:n})}getDecorativeLineAttr(t,e){var i;const n=(null===(i=null==t?void 0:t.decorativeLine)||void 0===i?void 0:i.length)||10,s=this._line.getEndAngle()||0;return{startPointOffsetX:n/2*Math.cos(s-Math.PI/2),startPointOffsetY:n/2*Math.sin(s-Math.PI/2),endPointOffsetX:-n/2*Math.cos(s-Math.PI/2),endPointOffsetY:-n/2*Math.sin(s-Math.PI/2)}}setDecorativeLineAttr(t,e,i){var n;const{lineStyle:s}=t,{startPointOffsetX:r,startPointOffsetY:a,endPointOffsetX:o,endPointOffsetY:l}=this.getDecorativeLineAttr(t,e);null===(n=this._decorativeLine)||void 0===n||n.setAttributes(Object.assign(Object.assign({points:[{x:e.x+r,y:e.y+a},{x:e.x+o,y:e.y+l}]},s),{visible:i}))}initMarker(t){var e;const{position:i,itemLine:n,itemContent:s}=this.attribute,r={x:i.x+((null==s?void 0:s.offsetX)||0),y:i.y+((null==s?void 0:s.offsetY)||0)},a=new cY({points:[]});a.name="mark-point-line",this._line=a,t.add(a);const o=jO({points:[]});o.name="mark-point-decorativeLine",this._decorativeLine=o,t.add(o),this.setItemLineAttr(n,i,r,null==n?void 0:n.visible),this.setDecorativeLineAttr(n,r,null===(e=null==n?void 0:n.decorativeLine)||void 0===e?void 0:e.visible);const l=this.initItem(s,r);this._item=l,t.add(l)}updateMarker(){var t;const{position:e,itemLine:i,itemContent:n}=this.attribute,{type:s="text"}=n,r={x:e.x+((null==n?void 0:n.offsetX)||0),y:e.y+((null==n?void 0:n.offsetY)||0)};this.setItemLineAttr(i,e,r,null==i?void 0:i.visible),this.setDecorativeLineAttr(i,r,null===(t=null==i?void 0:i.decorativeLine)||void 0===t?void 0:t.visible),this.setItemAttributes(this._item,n,r,s)}};YY.defaultAttributes={itemLine:{visible:!0,decorativeLine:{visible:!1,length:30},startSymbol:{visible:!0,clip:!0,symbolType:"circle",size:20,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},endSymbol:{visible:!1,clip:!0,symbolType:"triangle",size:12,style:{fill:!1,stroke:"rgba(46, 47, 50)"}},lineStyle:{stroke:"#000",lineWidth:1}},itemContent:{type:"text",position:"middle",refX:10,symbolStyle:{symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},textStyle:{dx:0,dy:0},imageStyle:{width:80,height:80},richTextStyle:{width:100,height:100}}};const XY={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};class $Y extends KG{getCurrent(){return this._current}constructor(t){super(D({},$Y.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=>{var e,i;const n=t.target;if("preHandler"===n.name){if(1===this._current)return;this._current-=1,1===this._current?n.addState("disable"):n.removeState("disable");const t=new wC("toPrev",{current:this._current,total:this._total,direction:"pre"});t.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,this.dispatchEvent(t)}if("nextHandler"===n.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?n.addState("disable"):n.removeState("disable");const t=new wC("toNext",{current:this._current,total:this._total,direction:"next"});t.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(t)}this._current>1&&this.preHandler.removeState("disable"),this._current{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;t.hasState(JY.selected)?this._setLegendItemState(t,JY.selectedHover):this._setLegendItemState(t,JY.unSelectedHover);const e=t.getChildren()[0].find((t=>t.name===tX.focus),!1);e&&e.setAttribute("visible",!0),this._dispatchEvent(QY.legendItemHover,t)}},this._onUnHover=t=>{var e;const i=t.target;if(null===(e=null==i?void 0:i.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=i.delegate;let e=!1;(t.hasState(JY.unSelectedHover)||t.hasState(JY.selectedHover))&&(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{e||!t.hasState(JY.unSelectedHover)&&!t.hasState(JY.selectedHover)||(e=!0),t.removeState(JY.unSelectedHover),t.removeState(JY.selectedHover)}));const n=t.getChildren()[0].find((t=>t.name===tX.focus),!1);n&&n.setAttribute("visible",!1),e&&this._dispatchEvent(QY.legendItemAttributeUpdate,t),this._dispatchEvent(QY.legendItemUnHover,t)}},this._onClick=t=>{var e,i,n,s,r;const a=t.target;if(null===(e=null==a?void 0:a.name)||void 0===e?void 0:e.startsWith(tX.item)){const t=a.delegate;if(a.name===tX.focus){const e=t.hasState(JY.focus);t.toggleState(JY.focus),e?null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((t=>{this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover,JY.focus]),this._setLegendItemState(t,JY.selected)})):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover,JY.focus]),this._setLegendItemState(e,JY.unSelected))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(JY.focus)}));const{selectMode:e="multiple",allowAllCanceled:i=!0}=this.attribute,n=t.hasState(JY.selected),a=this._getSelectedLegends();if("multiple"===e){if(!1===i&&n&&1===a.length)return void this._dispatchEvent(QY.legendItemClick,t);n?(this._removeLegendItemState(t,[JY.selected,JY.selectedHover]),this._setLegendItemState(t,JY.unSelected)):(this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]))}else this._setLegendItemState(t,JY.selected),this._removeLegendItemState(t,[JY.unSelected,JY.unSelectedHover]),null===(r=this._itemsContainer)||void 0===r||r.getChildren().forEach((e=>{t!==e&&(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}this._dispatchEvent(QY.legendItemClick,t)}}}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,JY.selected),this._removeLegendItemState(e,[JY.unSelected,JY.unSelectedHover])):(this._removeLegendItemState(e,[JY.selected,JY.selectedHover]),this._setLegendItemState(e,JY.unSelected))}))}_renderContent(){const{item:t={},items:e,reversed:i,maxCol:n=1,maxRow:s=2}=this.attribute;if(!1===t.visible||C(e))return;let r=e;i&&(r=null==e?void 0:e.reverse());const a=FO({x:0,y:0});this._itemsContainer=a;const{layout:o,maxWidth:l,maxHeight:c,defaultSelected:d=[],autoPage:u}=this.attribute,p="horizontal"===o,{spaceCol:g=KY,spaceRow:f=qY,maxWidth:v,width:m,height:y}=t;h(v)?h(m)?this._itemWidthByUser=Math.min(v,m):this._itemWidthByUser=v:h(m)&&(this._itemWidthByUser=m),h(y)&&(this._itemHeightByUser=y);let _=!1,b=0,x=0,S=0,w=1,A=1;r.forEach(((t,e)=>{t.id||(t.id=t.label),t.index=e;const i=this._renderEachItem(t,!!C(d)||(null==d?void 0:d.includes(t.label)),e,r),o=i.attribute.width,u=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,u),b=Math.max(o,b),this._itemMaxWidth=Math.max(o,this._itemMaxWidth),p?(w=s,h(l)&&(o>=l?(_=!0,e>0&&(x=0,S+=u+f,A+=1)):l0&&i.setAttributes({x:x,y:S}),x+=g+o):(w=n,h(c)&&c0&&i.setAttributes({x:x,y:S}),S+=f+u),a.add(i)}));let k=!1;_&&u&&A>w&&(k=this._renderPager(p)),k||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;t&&(this._itemsContainer.addEventListener("pointermove",this._onHover),this._itemsContainer.addEventListener("pointerout",this._onUnHover)),e&&this._itemsContainer.addEventListener("pointerdown",this._onClick)}_renderEachItem(t,e,i,n){const{id:s,label:r,value:a,shape:o}=t,{padding:c=0,focus:d,focusIconStyle:u={}}=this.attribute.item;let{shape:p={},label:g={},value:f={},background:v={}}=this.attribute.item;p=this._handleStyle(p,t,e,i,n),g=this._handleStyle(g,t,e,i,n),f=this._handleStyle(f,t,e,i,n),v=this._handleStyle(v,t,e,i,n);const m=Ze(c);let y;!1===v.visible?(y=FO({x:0,y:0,cursor:(null==v?void 0:v.style).cursor}),this._appendDataToShape(y,tX.item,t,y)):(y=FO(Object.assign({x:0,y:0},null==v?void 0:v.style)),this._appendDataToShape(y,tX.item,t,y,null==v?void 0:v.state)),y.addState(e?JY.selected:JY.unSelected);const _=FO({x:0,y:0,pickable:!1});y.add(_);let b=0;const x=T(p,"style.size",10),S=T(p,"space",8),w=WO(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},o),p.style));let A;Object.keys(p.state||{}).forEach((t=>{const e=p.state[t].fill||p.state[t].stroke;o.fill&&l(p.state[t].fill)&&e&&(p.state[t].fill=e),o.stroke&&l(p.state[t].stroke)&&e&&(p.state[t].stroke=e)})),this._appendDataToShape(w,tX.itemShape,t,y,null==p?void 0:p.state),w.addState(e?JY.selected:JY.unSelected),_.add(w);let k=0;if(d){const e=T(u,"size",10);A=WO(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0},u),{visible:!1,pickMode:"imprecise",boundsPadding:m})),this._appendDataToShape(A,tX.focus,t,y),k=e}const M=VO(Object.assign(Object.assign({x:x/2+S,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==g?void 0:g.style).fontSize},null==g?void 0:g.style),{text:g.formatMethod?g.formatMethod(r,t,i):r}));this._appendDataToShape(M,tX.itemLabel,t,y,null==g?void 0:g.state),M.addState(e?JY.selected:JY.unSelected),_.add(M);const C=T(g,"space",8);if(b+=x/2+S+M.AABBBounds.width()+C,h(a)){const n=T(f,"space",d?8:0),s=VO(Object.assign(Object.assign({x:b+C,y:0,textAlign:"start",textBaseline:"middle",lineHeight:(null==f?void 0:f.style).fontSize},null==f?void 0:f.style),{text:f.formatMethod?f.formatMethod(a,t,i):a}));if(this._appendDataToShape(s,tX.itemValue,t,y,null==f?void 0:f.state),s.addState(e?JY.selected:JY.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-m[1]-m[3]-x-S-C-k-n,e=s.AABBBounds,i=M.AABBBounds,r=e.width(),a=i.width();a>t?(t-r)/a>.4?M.setAttribute("maxLineWidth",t-r):(s.setAttribute("maxLineWidth",.5*t),M.setAttribute("maxLineWidth",.5*t)):s.setAttribute("maxLineWidth",t-a),f.alignRight&&s.setAttributes({textAlign:"right",x:this._itemWidthByUser-x/2-m[1]-m[3]-k-n})}b=s.AABBBounds.x2+n,_.add(s)}else this._itemWidthByUser&&M.setAttribute("maxLineWidth",this._itemWidthByUser-m[1]-m[3]-x-S-k);A&&(A.setAttribute("x",b),_.add(A));const E=_.AABBBounds,P=E.width(),R=E.height(),O=h(this.attribute.item.width)?this.attribute.item.width:P+m[1]+m[3],B=this._itemHeightByUser||R+m[0]+m[2];return y.attribute.width=O,y.attribute.height=B,_.translateTo(-E.x1+m[3],-E.y1+m[0]),y}_renderPager(t){const e=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",8):0,{maxWidth:i,maxHeight:n,maxCol:s=1,maxRow:r=2,item:a={},pager:o={}}=this.attribute,{spaceCol:l=KY,spaceRow:h=qY}=a,c=this._itemsContainer,{animation:d=!0,animationDuration:u=450,animationEasing:p="quadIn",space:g=ZY}=o,f=iX(o,["animation","animationDuration","animationEasing","space"]);let v,m=0,y=0,_=0,b=0,x=1;if(t){if(v=new $Y(Object.assign({layout:1===r?"horizontal":"vertical",total:99},D({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},f))),this._pager=v,this._innerView.add(v),m=(r-1)*h+this._itemHeight*r,y=i-v.AABBBounds.width()-g,y<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{width:i,height:n}=t.attribute;y<_+i&&(_=0,b+=n+h,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=l+i})),v.setAttributes({total:Math.ceil(x/r),x:y,y:e+m/2-v.AABBBounds.height()/2})}else{if(v=new $Y(Object.assign({layout:"horizontal",total:99},f)),this._pager=v,this._innerView.add(v),y=this._itemMaxWidth*s+(s-1)*l,m=n-v.AABBBounds.height()-g-e,m<=0)return this._innerView.removeChild(v),!1;c.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;m0&&t.setAttributes({x:_,y:b}),b+=h+i})),v.setAttributes({total:Math.ceil(x/s),x:(y-v.AABBBounds.width())/2,y:n-v.AABBBounds.height()})}o.defaultCurrent>1&&(t?c.setAttribute("y",-(o.defaultCurrent-1)*(m+h)):c.setAttribute("x",-(o.defaultCurrent-1)*(y+l)));const S=FO({x:0,y:e,width:y,height:m,clip:!0,pickable:!1});S.add(c),this._innerView.add(S);const w=e=>{const{current:i}=e.detail;d?c.animate().to(t?{y:-(i-1)*(m+h)}:{x:-(i-1)*(y+l)},u,p):t?c.setAttribute("y",-(i-1)*(m+h)):c.setAttribute("x",-(i-1)*(y+l))};return this._pager.addEventListener("toPrev",w),this._pager.addEventListener("toNext",w),!0}_setLegendItemState(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!1;t.hasState(e)||(n=!0),t.addState(e,i),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&(n||t.hasState(e)||(n=!0),t.addState(e,i))})),n&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_removeLegendItemState(t,e){let i=!1;e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==tX.focus&&e.forEach((e=>{!i&&t.hasState(e)&&(i=!0),t.removeState(e)}))})),i&&this._dispatchEvent(QY.legendItemAttributeUpdate,t)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(JY.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=n,t.states=D({},nX,s)}_dispatchEvent(t,e){var i;const n=this._getSelectedLegends();n.sort(((t,e)=>t.index-e.index));const s=n.map((t=>t.label)),r=new wC(t,{item:e,data:e.data,selected:e.hasState(JY.selected),currentSelectedItems:n,currentSelected:s});r.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(r)}_handleStyle(t,e,i,n,s){const r=D({},t);return t.style&&o(t.style)&&(r.style=t.style(e,i,n,s)),t.state&&Object.keys(t.state).forEach((a=>{t.state[a]&&o(t.state[a])&&(r.state[a]=t.state[a](e,i,n,s))})),r}};var rX;function aX(t){return f(t)?t:[t,t]}function oX(t){return t?"ew-resize":"ns-resize"}sX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:KY,spaceRow:qY,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},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:ZY,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"}(rX||(rX={}));let lX=class t extends KG{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}constructor(e){super(D({},t.defaultAttributes,e)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._currentHandler=t.target,this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onHandlerPointerMove),XH.addEventListener("pointerup",this._onHandlerPointerUp)):(this._currentHandler.addEventListener("pointermove",this._onHandlerPointerMove),this._currentHandler.addEventListener("pointerup",this._onHandlerPointerUp),this._currentHandler.addEventListener("pointerupoutside",this._onHandlerPointerUp))},this._onHandlerPointerMove=t=>{var e,i;t.stopPropagation();const{railWidth:n,railHeight:s,min:r,max:a}=this.attribute;if(a===r)return;let o,l,h,c=0;this._isHorizontal?(o=t.clientX,c=o-this._prePos,l=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,h=n):(o=t.clientY,c=o-this._prePos,l=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,h=s);const d=ut(l+c,0,h),u=d/h*(a-r)+r;"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,d,u):this._updateHandler(this._currentHandler,d,u),this._updateTrack(),this._prePos=o,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{if(t.preventDefault(),this._currentHandler=null,"browser"===XH.env)XH.removeEventListener("pointermove",this._onHandlerPointerMove),XH.removeEventListener("pointerup",this._onHandlerPointerUp);else{const e=t.target;e.removeEventListener("pointermove",this._onHandlerPointerMove),e.removeEventListener("pointerup",this._onHandlerPointerUp),e.removeEventListener("pointerupoutside",this._onHandlerPointerUp)}},this._onTrackPointerdown=t=>{t.stopPropagation(),this._prePos=this._isHorizontal?t.clientX:t.clientY,"browser"===XH.env?(XH.addEventListener("pointermove",this._onTrackPointerMove),XH.addEventListener("pointerup",this._onTrackPointerUp)):(this._track.addEventListener("pointermove",this._onTrackPointerMove),this._track.addEventListener("pointerup",this._onTrackPointerUp),this._track.addEventListener("pointerupoutside",this._onTrackPointerUp))},this._onTrackPointerMove=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const{startHandler:r,endHandler:a}=this._getHandlers();let o,l,h;this._isHorizontal?(o=t.clientX,l=this._track.attribute.width,h=e):(o=t.clientY,l=this._track.attribute.height,h=i);const c=o-this._prePos;if(r){const t=this._isHorizontal?r.attribute.x:r.attribute.y,e=ut(t+c,0,h-l),i=e/h*(s-n)+n;this._updateHandler(r,e,i)}if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=ut(t+c,l,h),i=e/h*(s-n)+n;this._updateHandler(a,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(null==r?void 0:r.attribute.x,null==a?void 0:a.attribute.x),width:Math.abs((null==r?void 0:r.attribute.x)-(null==a?void 0:a.attribute.x))}:{y:Math.min(null==r?void 0:r.attribute.y,null==a?void 0:a.attribute.y),height:Math.abs((null==r?void 0:r.attribute.y)-(null==a?void 0:a.attribute.y))})}this._prePos=o,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),"browser"===XH.env?(XH.removeEventListener("pointermove",this._onTrackPointerMove),XH.removeEventListener("pointerup",this._onTrackPointerUp)):(this._track.removeEventListener("pointermove",this._onTrackPointerMove),this._track.removeEventListener("pointerup",this._onTrackPointerUp),this._track.removeEventListener("pointerupoutside",this._onTrackPointerUp))},this._onRailPointerDown=t=>{t.stopPropagation();const{railWidth:e,railHeight:i,min:n,max:s}=this.attribute;if(s===n)return;const r=this._startHandler,a=this._endHandler;let o,l,c,d;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,c=null==a?void 0:a.attribute.x,d=e):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,c=null==a?void 0:a.attribute.y,d=i);const u=o/d*(s-n)+n;if(h(c)){const t=Math.abs(o-l)>Math.abs(o-c)?a:r;this._updateHandler(t,o,u)}else this._updateHandler(r,o,u);this._updateTrack(),this._dispatchChangeEvent()}}setValue(t){const{layout:e,railWidth:i,railHeight:n,min:s,max:r}=this.attribute;if(r===s)return;const[a,o]=V(t),{startHandler:l,endHandler:h}=this._getHandlers(),c="vertical"===e?n:i,d=(a-s)/(r-s)*c;if(l&&this._updateHandler(l,d,a),h){const t=(o-s)/(r-s)*c;this._updateHandler(h,t,o)}this._updateTrack()}render(){var t,e;this.removeAllChild();const{layout:i="horizontal",railWidth:n,railHeight:s,startText:r,endText:a,min:o,max:c,showHandler:d=!0}=this.attribute;let{value:u}=this.attribute;l(u)&&(u=[o,c]),this._currentValue={startValue:aX(u)[0],endValue:aX(u)[1]};const p="horizontal"===i;this._isHorizontal=p;const g=FO({x:0,y:0});g.name=rX.innerView,this.add(g),this._innerView=g;let f,v=0;if(r&&r.visible){f=VO(Object.assign({x:p?0:n/2,y:p?s/2:0,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=rX.startText,g.add(f);const e=h(r.space)?r.space:0;v+=(p?f.AABBBounds.width():f.AABBBounds.height())+e}const m=FO({x:p?v:0,y:p?0:v});g.add(m);const y=FO({x:0,y:0});let _;if(y.name=rX.railContainer,this._railContainer=y,m.add(y),this._renderRail(y),v+=p?n:s,a&&a.visible){const t=h(a.space)?a.space:0;_=VO(Object.assign({x:p?v+t:n/2,y:p?s/2:v+t,textAlign:p?"start":"center",textBaseline:p?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),_.name=rX.endText,g.add(_)}this._renderTrack(y),d&&(this._renderHandlers(m),this._bindEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:n,slidable:s}=this.attribute;let r="default";!1!==s&&(r="pointer");const a=HO(Object.assign({x:0,y:0,width:e,height:i,cursor:r},n));return a.name=rX.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:n,handlerSize:s=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:h,slidable:c}=this.attribute;let{value:d}=this.attribute;l(d)&&(d=[i,n]);const u=a&&a.visible,p=this._isHorizontal,g=p?h:o,[f,v]=aX(d),m=n===i?e?0:g:(f-i)/(n-i)*g,y=this._renderHandler(Object.assign({x:p?m:h/2,y:p?o/2:m,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(y.name=rX.startHandler,this._startHandler=y,t.add(y),this._currentValue.startPos=m,u){const i=this._renderHandlerText(f,e?"start":"end");i.name=rX.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=n===i?g:(v-i)/(n-i)*g,a=this._renderHandler(Object.assign({x:p?e:h/2,y:p?o/2:e,size:s,strokeBoundsBuffer:0,cursor:!1===c?"default":oX(p)},r));if(a.name=rX.endHandler,this._endHandler=a,t.add(a),this._currentValue.endPos=e,u){const e=this._renderHandlerText(v,"end");e.name=rX.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:n,railHeight:s,railWidth:r,trackStyle:a,railStyle:o,slidable:h,value:d}=this.attribute;let u,p;if(l(d))e?(u=i,p=n):u=p=i;else if(e){const t=pt(d,i,n);u=t[0],p=t[1]}else u=i,p=ut(d,i,n);const g=this._isHorizontal,f=g?r:s;e||(u=i);const v=FO({x:0,y:0,width:r,height:s,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});v.name=rX.trackContainer;const m=c(e)&&!0===e.draggableTrack;let y;y=!1===h?"default":!1===e||!1===m?"pointer":oX(g);const _=n===i?f:(p-u)/(n-i)*f,b=n===i?0:(u-i)/(n-i)*f,x=HO(Object.assign({x:g?b:0,y:g?0:b,width:g?_:r,height:g?s:_,cursor:y},a));x.name=rX.track,this._track=x,v.add(x),t.add(v)}_renderHandler(t){return WO(t)}_renderHandlerText(t,e){var i,n,s;const{align:r,min:a,max:o,handlerSize:l=14,handlerText:h={},railHeight:c,railWidth:d,slidable:u}=this.attribute,p=this._isHorizontal,g=p?d:c,f=o===a?"start"===e?0:g:(t-a)/(o-a)*g,v=null!==(i=h.space)&&void 0!==i?i:4,m=Object.assign({text:(null==h?void 0:h.formatter)?h.formatter(t):t.toFixed(null!==(n=null==h?void 0:h.precision)&&void 0!==n?n:0),lineHeight:null===(s=h.style)||void 0===s?void 0:s.lineHeight,cursor:!1===u?"default":oX(p)},h.style);return p?"top"===r?(m.textBaseline="bottom",m.textAlign="center",m.x=f,m.y=(c-l)/2-v):(m.textBaseline="top",m.textAlign="center",m.x=f,m.y=(c+l)/2+v):"left"===r?(m.textBaseline="middle",m.textAlign="end",m.x=(d-l)/2-v,m.y=f):(m.textBaseline="middle",m.textAlign="start",m.x=(d+l)/2+v,m.y=f),VO(m)}_bindEvents(){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),c(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_updateTrack(){const t=this._startHandler,e=this._endHandler;if(this._isHorizontal){const i=null==t?void 0:t.attribute.x;if(e){const t=null==e?void 0:e.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else this._track.setAttributes({width:i})}else{const i=null==t?void 0:t.attribute.y;if(e){const t=null==e?void 0:e.attribute.y;this._track.setAttributes({y:Math.min(i,t),height:Math.abs(i-t)})}else this._track.setAttributes({height:i})}}_updateHandler(t,e,i){var n;const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const r=t.name===rX.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t}=this.attribute;null==r||r.setAttributes({text:(null==t?void 0:t.formatter)?t.formatter(i):i.toFixed(null!==(n=null==t?void 0:t.precision)&&void 0!==n?n:0),[s?"x":"y"]:e})}t.name===rX.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var n;const s=this._isHorizontal,{handlerText:r}=this.attribute;t.setAttributes({[s?"x":"y"]:e,text:(null==r?void 0:r.formatter)?r.formatter(i):i.toFixed(null!==(n=null==r?void 0:r.precision)&&void 0!==n?n:0)});const a=t.name===rX.startHandlerText?this._startHandler:this._endHandler;a&&(null==a||a.setAttributes({[s?"x":"y"]:e})),t.name===rX.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){var t;const e=!!this.attribute.range,i=this._currentValue,n=new wC("change",{value:e?[Math.min(i.endValue,i.startValue),Math.max(i.endValue,i.startValue)]:i.startValue,position:e?[Math.min(i.endPos,i.startPos),Math.max(i.endPos,i.startPos)]:i.startPos});n.manager=null===(t=this.stage)||void 0===t?void 0:t.eventSystem.manager,this.dispatchEvent(n)}_getHandlers(){let t,e=this._startHandler,i=this._endHandler;return this._isHorizontal?i&&i.attribute.x<(null==e?void 0:e.attribute.x)&&(t=e,e=i,i=t):i&&i.attribute.y<(null==e?void 0:e.attribute.y)&&(t=e,e=i,i=t),{startHandler:e,endHandler:i}}};lX.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},railStyle:{fill:"rgba(0,0,0,.04)"},trackStyle:{fill:"#91caff"},showValue:!0,valueStyle:{fill:"#2C3542",fontSize:12},startText:{style:{fill:"#2C3542",fontSize:12}},endText:{style:{fill:"#2C3542",fontSize:12}},handlerText:{visible:!0,space:4,precision:0,style:{fill:"#2C3542",fontSize:12}}};class hX extends eX{constructor(t){super(D({},hX.defaultAttributes,t)),this.name="colorLegend",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:n,min:s,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:f,handlerText:v,showTooltip:m,tooltip:y}=this.attribute,_=[],b=(r-s)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(h,c),i=Math.max(h,c),n=e/p,s=i/p,r=s-n,d=t.filter((t=>t.offset>n&&t.offset{m.push({offset:(t.offset-n)/r,color:t.color})})),m.push({offset:1,color:v}),a.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:m}))}}}function cX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}hX.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}}};class dX extends eX{constructor(t){super(D({},dX.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m,sizeBackground:y}=this.attribute,_=FO({x:0,y:0});this._innerView.add(_);const b=new lX({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:n,max:s,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:cX(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:v,tooltip:m});_.add(b);let x,S=0;"horizontal"===e?"top"===i?(x=`M0,0L${a},0L${a},12Z`,S=o):(x=`M0,12L${a},12L${a},0Z`,b.setAttribute("y",12)):"left"===i?x=`M${a},0L${a},0L${a+12},${o}L${a},${o}Z`:(x=`M0,${o}L12,${o}L12,0Z`,b.setAttribute("x",12));const w=zO(Object.assign(Object.assign({x:0,y:S,path:x},y),{zIndex:0}));_.add(w);const A=this._title?this._title.AABBBounds.height()+T(this.attribute,"title.space",12):0;_.translate(0-_.AABBBounds.x1,A-_.AABBBounds.y1),this._slider=b}_bindEvents(){this._slider&&this._slider.addEventListener("change",this._onSliderChange)}}dX.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)"}};let uX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,n,s,r,a,o,l,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$,K,q,Z,J,Q,tt,et,it,nt,st,rt,at,ot,lt;const{text:ht,textStyle:ct,subtext:dt,subtextStyle:ut,width:pt,height:gt,minWidth:ft,maxWidth:vt,minHeight:mt,maxHeight:yt,align:_t,verticalAlign:bt,padding:xt=0}=this.attribute,St=Ze(xt),wt=this.createOrUpdateChild("title-container",{x:St[3],y:St[0],zIndex:1},"group");if(!1!==(null===(t=this.attribute)||void 0===t?void 0:t.visible)&&!1!==(null==ct?void 0:ct.visible))if(ct&&h(null==ct?void 0:ct.character)){const t={x:null!==(e=ct.x)&&void 0!==e?e:0,y:null!==(i=ct.y)&&void 0!==i?i:0,width:null!==(s=null!==(n=ct.width)&&void 0!==n?n:pt)&&void 0!==s?s:0,height:null!==(a=null!==(r=ct.height)&&void 0!==r?r:gt)&&void 0!==a?a:0,ellipsis:null===(o=ct.ellipsis)||void 0===o||o,wordBreak:null!==(l=ct.wordBreak)&&void 0!==l?l:"break-word",maxHeight:ct.maxHeight,maxWidth:ct.maxWidth,textConfig:ct.character};this._mainTitle=wt.createOrUpdateChild("mainTitle",t,"richtext")}else h(ht)&&(this._mainTitle=wt.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:[ht]},ct),{maxLineWidth:null!==(c=null==ct?void 0:ct.maxLineWidth)&&void 0!==c?c:pt,heightLimit:null==ct?void 0:ct.heightLimit,lineClamp:null==ct?void 0:ct.lineClamp,ellipsis:null===(d=null==ct?void 0:ct.ellipsis)||void 0===d||d,x:0,y:0}),"wrapText"));const At=this._mainTitle?null===(u=this._mainTitle)||void 0===u?void 0:u.AABBBounds.height():0,kt=this._mainTitle?null===(p=this._mainTitle)||void 0===p?void 0:p.AABBBounds.width():0;if(!1!==(null===(g=this.attribute)||void 0===g?void 0:g.visible)&&!1!==(null==ut?void 0:ut.visible))if(ut&&h(null==ut?void 0:ut.character)){const t={x:null!==(f=ut.x)&&void 0!==f?f:0,y:null!==(v=ut.y)&&void 0!==v?v:At,width:null!==(y=null!==(m=ut.width)&&void 0!==m?m:pt)&&void 0!==y?y:0,height:null!==(b=null!==(_=ut.height)&&void 0!==_?_:gt)&&void 0!==b?b:0,ellipsis:null===(x=ut.ellipsis)||void 0===x||x,wordBreak:null!==(S=ut.wordBreak)&&void 0!==S?S:"break-word",maxHeight:ut.maxHeight,maxWidth:ut.maxWidth,textConfig:ut.character};this._subTitle=wt.createOrUpdateChild("subTitle",t,"richtext")}else h(dt)&&(this._subTitle=wt.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:[dt]},ut),{maxLineWidth:null!==(w=null==ut?void 0:ut.maxLineWidth)&&void 0!==w?w:pt,heightLimit:null==ut?void 0:ut.heightLimit,lineClamp:null==ut?void 0:ut.lineClamp,ellipsis:null===(A=null==ut?void 0:ut.ellipsis)||void 0===A||A,x:0,y:At}),"wrapText"));const Mt=this._subTitle?null===(k=this._subTitle)||void 0===k?void 0:k.AABBBounds.height():0,Ct=this._subTitle?null===(M=this._subTitle)||void 0===M?void 0:M.AABBBounds.width():0;let Tt=Math.max(kt,Ct),Et=At+(null!==(C=null==ut?void 0:ut.height)&&void 0!==C?C:Mt);if(h(pt)&&(Tt=pt,null===(T=this._mainTitle)||void 0===T||T.setAttribute("maxLineWidth",pt),null===(E=this._subTitle)||void 0===E||E.setAttribute("maxLineWidth",pt)),h(gt)&&(Et=gt),h(ft)&&Ttvt&&(Tt=vt)),h(mt)&&Etyt&&(Et=yt)),wt.attribute.width=Tt+St[1]+St[3],wt.attribute.height=Et+St[0]+St[2],h(_t)||h(null==ct?void 0:ct.align)){const t=(null==ct?void 0:ct.align)?null==ct?void 0:ct.align:_t,e=null!==(L=null==ct?void 0:ct.width)&&void 0!==L?L:kt;"left"===t?(null===(F=this._mainTitle)||void 0===F||F.setAttribute("x",0),null===(j=this._mainTitle)||void 0===j||j.setAttribute("textAlign","left")):"center"===t?(null===(z=this._mainTitle)||void 0===z||z.setAttribute("x",e/2),null===(H=this._mainTitle)||void 0===H||H.setAttribute("textAlign","center")):"right"===t&&(null===(N=this._mainTitle)||void 0===N||N.setAttribute("x",e),null===(V=this._mainTitle)||void 0===V||V.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ct?void 0:ct.verticalAlign)?null==ct?void 0:ct.verticalAlign:bt,e=(null==ct?void 0:ct.height)?null==ct?void 0:ct.height:Tt;"top"===t?(null===(W=this._mainTitle)||void 0===W||W.setAttribute("y",0),null===(G=this._mainTitle)||void 0===G||G.setAttribute("textBaseline","top")):"middle"===t?(null===(U=this._mainTitle)||void 0===U||U.setAttribute("y",e/2),null===(Y=this._mainTitle)||void 0===Y||Y.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(X=this._mainTitle)||void 0===X||X.setAttribute("y",e),null===($=this._mainTitle)||void 0===$||$.setAttribute("textBaseline","bottom"))}if(h(_t)||h(null==ut?void 0:ut.align)){const t=(null==ut?void 0:ut.align)?null==ut?void 0:ut.align:_t,e=null!==(K=null==ut?void 0:ut.width)&&void 0!==K?K:Ct;"left"===t?(null===(q=this._subTitle)||void 0===q||q.setAttribute("x",0),null===(Z=this._subTitle)||void 0===Z||Z.setAttribute("textAlign","left")):"center"===t?(null===(J=this._subTitle)||void 0===J||J.setAttribute("x",e/2),null===(Q=this._subTitle)||void 0===Q||Q.setAttribute("textAlign","center")):"right"===t&&(null===(tt=this._subTitle)||void 0===tt||tt.setAttribute("x",e),null===(et=this._subTitle)||void 0===et||et.setAttribute("textAlign","right"))}if(h(bt)||h(null==ct?void 0:ct.verticalAlign)){const t=(null==ut?void 0:ut.verticalAlign)?null==ut?void 0:ut.verticalAlign:bt,e=At,i=null!==(it=null==ut?void 0:ut.height)&&void 0!==it?it:0;"top"===t?(null===(nt=this._subTitle)||void 0===nt||nt.setAttribute("y",e),null===(st=this._subTitle)||void 0===st||st.setAttribute("textBaseline","top")):"middle"===t?(null===(rt=this._subTitle)||void 0===rt||rt.setAttribute("y",e+i/2),null===(at=this._subTitle)||void 0===at||at.setAttribute("textBaseline","middle")):"bottom"===t&&(null===(ot=this._subTitle)||void 0===ot||ot.setAttribute("y",e+i),null===(lt=this._subTitle)||void 0===lt||lt.setAttribute("textBaseline","bottom"))}}};uX.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 pX={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"}}};let gX=class extends KG{constructor(){super(...arguments),this.name="indicator"}render(){var t;const{visible:e,title:i,content:n,size:s,limitRatio:r=1/0}=this.attribute,a=Math.min(s.width,s.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1},"group");if(!0!==e)return void(o&&o.hideAll());if(h(i))if(!1!==i.visible){const t=D({},T(pX,"title.style"),i.style);this._title=o.createOrUpdateChild("indicator-title",Object.assign(Object.assign({},t),{lineHeight:h(t.lineHeight)?t.lineHeight:t.fontSize,visible:i.visible,x:0,y:0}),"text"),i.autoFit&&_(a)&&this._setAutoFit(a,this._title,i),i.autoLimit&&_(r)&&this._title.setAttribute("maxLineWidth",a)}else{const t=o.find((t=>"indicator-title"===t.name),!1);t&&o.removeChild(t),this._title=void 0}const l=this._title?this._title.AABBBounds.height():0;if(h(n)){const t=this._title&&(null==i?void 0:i.space)?i.space:0,e=V(n),s=[];let c=0;e.forEach(((e,i)=>{if(!1!==e.visible){const n=D({},T(pX,"content.style"),e.style),d=o.createOrUpdateChild("indicator-content-"+i,Object.assign(Object.assign({},n),{lineHeight:h(n.lineHeight)?n.lineHeight:n.fontSize,visible:e.visible,x:0,y:l+t+c}),"text");e.autoFit&&_(a)&&this._setAutoFit(a,d,e),e.autoLimit&&_(r)&&d.setAttribute("maxLineWidth",a),s.push(d);const u=(null==e?void 0:e.space)?e.space:0;c+=d.AABBBounds.height()+u}else{const t=o.find((t=>t.name==="indicator-content-"+i),!1);t&&o.removeChild(t)}})),this._content=s}const c=null!==(t=null==o?void 0:o.AABBBounds.height())&&void 0!==t?t:0;o.setAttribute("y",s.height/2-c/2),o.setAttribute("x",s.width/2)}_setAutoFit(t,e,i){var n,s,r,a,o,l;const c=gU(null!==(s=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==s?s:"",null!==(r=i.style)&&void 0!==r?r:{}).width;if(c>0){const n=t*(null!==(a=i.fitPercent)&&void 0!==a?a:.5)/c,s=Math.floor((null!==(l=null===(o=i.style)||void 0===o?void 0:o.fontSize)&&void 0!==l?l:20)*n);e.setAttribute("fontSize",s),e.setAttribute("lineHeight",h(i.style.lineHeight)?i.style.lineHeight:s)}}};class fX extends PR{constructor(t){super(t)}}var vX,mX;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(vX||(vX={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(mX||(mX={}));class yX extends KG{constructor(t){super(D({},yX.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"},yX.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"},yX.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},yX.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,n,s,r,a,o;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(e=null===(t=this._backwardAttr.style)||void 0===t?void 0:t.symbolType)&&void 0!==e?e:"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!==(n=null===(i=this._forwardAttr.style)||void 0===i?void 0:i.symbolType)&&void 0!==n?n:"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!==(r=null===(s=this._backwardAttr.style)||void 0===s?void 0:s.symbolType)&&void 0!==r?r:"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!==(o=null===(a=this._forwardAttr.style)||void 0===a?void 0:a.symbolType)&&void 0!==o?o:"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=()=>{l(this._playController)&&(this._playController=new fX(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{l(this._backwardController)&&(this._backwardController=new fX(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{l(this._forwardController)&&(this._forwardController=new fX(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{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._createCustomEvent=t=>{var e;const i=new wC(t,{eventType:t});return i.manager=null===(e=this.stage)||void 0===e?void 0:e.eventSystem.manager,i},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=()=>{const t=this._createCustomEvent(vX.OnPlay);this.dispatchEvent(t)},this.pause=()=>{const t=this._createCustomEvent(vX.OnPause);this.dispatchEvent(t)},this.forward=()=>{const t=this._createCustomEvent(vX.OnForward);this.dispatchEvent(t)},this.backward=()=>{const t=this._createCustomEvent(vX.OnBackward);this.dispatchEvent(t)},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()}}yX.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},yX.defaultAttributes={[mX.Start]:{},[mX.Pause]:{},[mX.Backward]:{},[mX.Forward]:{}};const _X={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bX=[200,10];var xX,SX;!function(t){t.Default="default",t.Reverse="reverse"}(xX||(xX={})),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"}(SX||(SX={}));const wX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,maxIndex:i,dataIndex:s})||(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,minIndex:n,dataIndex:s})},AX=t=>{let{direction:e,maxIndex:i,minIndex:n,dataIndex:s}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:n}=t;return e===xX.Default&&n===i})({direction:e,minIndex:n,dataIndex:s})||(t=>{let{direction:e,maxIndex:i,dataIndex:n}=t;return e===xX.Reverse&&n===i})({direction:e,maxIndex:i,dataIndex:s})},kX=t=>"top"===t||"bottom"===t;class MX extends KG{constructor(t){super(D({},MX.defaultAttributes,t)),this._data=[],this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e,i;let n;_(this._handlerStyle.size)?n=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(n=Ot(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:_(n)?n: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}};if(kX(this._orient)){const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.height)&&void 0!==e?e:bX[1];s.layout="horizontal",s.railHeight=i,s.railWidth=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),e=null!==(i=this._railStyle.width)&&void 0!==i?i:bX[1];s.layout="vertical",s.railWidth=e,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 lX(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward};return kX(this._orient)?(t.layout="horizontal",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.layout="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 yX(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initLayoutInfo(),this._initController(),this._initSlider()}_initAttributes(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;this._size=this.attribute.size,this._orient=this.attribute.orient,this._data=this.attribute.data,this._minIndex=0,this._maxIndex=this._data.length-1,this._sliderVisible=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.slider)||void 0===e?void 0:e.visible,this._railStyle=Object.assign({},null===(n=null===(i=this.attribute)||void 0===i?void 0:i.slider)||void 0===n?void 0:n.railStyle),this._trackStyle=Object.assign({},null===(r=null===(s=this.attribute)||void 0===s?void 0:s.slider)||void 0===r?void 0:r.trackStyle),this._handlerStyle=Object.assign({},null===(o=null===(a=this.attribute)||void 0===a?void 0:a.slider)||void 0===o?void 0:o.handlerStyle),this._controllerVisible=null===(h=null===(l=this.attribute)||void 0===l?void 0:l.controller)||void 0===h?void 0:h.visible,this._start=Object.assign({},null===(d=null===(c=this.attribute)||void 0===c?void 0:c.controller)||void 0===d?void 0:d.start),this._pause=Object.assign({},null===(p=null===(u=this.attribute)||void 0===u?void 0:u.controller)||void 0===p?void 0:p.pause),this._forward=Object.assign({},null===(f=null===(g=this.attribute)||void 0===g?void 0:g.controller)||void 0===f?void 0:f.forward),this._backward=Object.assign({},null===(m=null===(v=this.attribute)||void 0===v?void 0:v.controller)||void 0===m?void 0:m.backward)}_initLayoutInfo(){var t,e,i;const n=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),s=n.filter((t=>"end"!==t.position)),r=n.filter((t=>"end"===t.position)),a=null!==(t=kX(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bX[1],o=n.reduce(((t,e)=>{const i=e.style.size,n=y(i)?i:Ot(i[0],i[1]);return t+e.space+n}),0),l=this._sliderVisible?(kX(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=s.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:kX(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:kX(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:n,style:{size:s}}=e,r=y(s)?s:Ot(s[0],s[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:kX(this._orient)?t+n:(this._size.width-r)/2,y:kX(this._orient)?(this._size.height-r)/2:t+n}),t+n+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){var i;const n=new wC(t,{eventType:t,index:e,value:this._data[e]});n.manager=null===(i=this.stage)||void 0===i?void 0:i.eventSystem.manager,this.dispatchEvent(n)}}MX.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({},_X),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},_X),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},_X),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},_X),{key:"backward",position:"start"})}};class CX extends MX{constructor(t){super(D({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i,n;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:xX.Default,this._dataIndex=l(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(n=this.attribute.dataIndex)&&void 0!==n?n:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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(SX.change)}))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(wX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||AX({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xX.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SX.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=XH.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(SX.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,n)=>"default"===t?Math.min(e+1,n):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(SX.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=XH.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(),XH.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.pause))},this.backward=()=>{const t=Math.max(this._dataIndex-1,this._minIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.backward)},this.forward=()=>{const t=Math.min(this._dataIndex+1,this._maxIndex);this._updateDataIndex(t),this.dispatchCustomEvent(SX.change),this.dispatchCustomEvent(SX.forward)},this._initAttributes(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var TX,EX=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class PX extends MX{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t,e;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,this._dataIndex=null!==(e=this.attribute.dataIndex)&&void 0!==e?e:this._minIndex;const i=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=i?i:1)):(this._totalDuration=this._interval*i,this._interval=this.attribute.interval)},this._initEvents=()=>{this._controller.addEventListener(vX.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(vX.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(vX.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(vX.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,n=i/this._maxIndex;this._elapsed=n*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(SX.change))},this.play=()=>EX(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(SX.play),this._rafId=XH.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=XH.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,XH.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SX.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(SX.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(SX.forward)},this._initAttributes(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(TX||(TX={}));const RX=5,OX={debounce:vt,throttle:mt};let BX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="brush",this._activeDrawState=!1,this._cacheDrawPoints=[],this._isDrawedBeforeEnd=!1,this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._onBrushStart=t=>{var e,i;if(this._outOfInteractiveRange(t))return;const n=null===(i=null===(e=this.attribute)||void 0===e?void 0:e.brushMoved)||void 0===i||i;this._activeMoveState=n&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushEnd=t=>{var e;const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?(this._container.incrementalClearChild(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.brushClear,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})):this._outOfInteractiveRange(t)||this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:this._activeDrawState?TX.drawEnd:TX.moveEnd,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict}),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,null===(e=this._operatingMask)||void 0===e||e.setAttribute("pickable",!1)}}bindBrushEvents(){const{delayType:t="throttle",delayTime:e=0}=this.attribute;this.stage.addEventListener("pointerdown",this._onBrushStart),this.stage.addEventListener("pointermove",OX[t](this._onBrushing,e)),this.stage.addEventListener("pointerup",this._onBrushEnd),this.stage.addEventListener("pointerupoutside",this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+s,y:t.y+r})));if(Ve(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&this._container.incrementalClearChild(),this._addBrushMask(),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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:n}=this.attribute,{minY:s=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=n,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=s-c,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moveStart,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_drawing(t){var e;const i=this.eventPosToStagePos(t),{x1:n=0,x2:s=0,y1:r=0,y2:a=0}=null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds,{sizeThreshold:o=RX}=this.attribute;if(this._isDrawedBeforeEnd=!!(Math.abs(s-n)>o||Math.abs(r-a)>o),this._cacheDrawPoints.length>0){const t=this._cacheDrawPoints[this._cacheDrawPoints.length-1];if(i.x===(null==t?void 0:t.x)&&i.y===(null==t?void 0:t.y))return}this._cacheDrawPoints.push(i);const l=this._computeMaskPoints();this._operatingMask.setAttribute("points",l),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.drawing,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_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 n=i.x-e.x,s=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],n))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],s))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._updateDragMaskCallback&&this._updateDragMaskCallback({operateType:TX.moving,operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let n=[];const s=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return n="rect"===t?[s,{x:r.x,y:s.y},r,{x:s.x,y:r.y}]:"x"===t?[{x:s.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:s.x,y:i[1]}]:"y"===t?[{x:e[0],y:s.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:s.y}]:R(this._cacheDrawPoints),n}_addBrushMask(){const{brushStyle:t}=this.attribute,e=UO(Object.assign({points:R(this._cacheDrawPoints),cursor:"move",pickable:!1},t));e.name=`brush-${Date.now()}`,this._operatingMask=e,this._container.add(e),this._brushMaskAABBBoundsDict[e.name]=e.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:n=1/0,minX:s=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xn||a.y1?e-1:0),n=1;nnull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return D(t,...i,{shape:s.every(l)?void 0:D({},...s),key:r.every(l)?void 0:D({},...r),value:a.every(l)?void 0:D({},...a)})},DX=t=>{const{width:e,height:i,wordBreak:n="break-word",textAlign:s,textBaseline:r,text:a}=t;return{width:e,height:i,wordBreak:n,textAlign:s,textBaseline:r,singleLine:!1,textConfig:V(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}},LX={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:cU,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:cU,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new $t).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},FX=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];let jX=class t extends KG{constructor(e){super(D({},t.defaultAttributes,e)),this.name="tooltip"}render(){const{visible:e,content:i,panel:n,keyWidth:s,valueWidth:r,hasContentShape:a,autoCalculatePosition:o,autoMeasure:l}=this.attribute;if(!e)return void this.hideAll();l&&t.measureTooltip(this.attribute),o&&t.calculateTooltipPosition(this.attribute);const c=Ze(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:c[3],y:c[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",D({symbolType:"circle"},d.shape,{visible:JG(d)&&JG(d.shape)}),"symbol"),d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:JG(d)&&JG(d.value)},DX(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:"",visible:JG(d)&&JG(d.value)},d.value),"text");const u=JG(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:p,textBaseline:g}=d.value,f=n.width-c[3]-c[0]-u;"center"===p?this._tooltipTitle.setAttribute("x",u+f/2):"right"===p||"end"===p?this._tooltipTitle.setAttribute("x",u+f):this._tooltipTitle.setAttribute("x",u),"bottom"===g?this._tooltipTitle.setAttribute("y",d.height):"middle"===g?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const v=JG(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(),null==i?void 0:i.length){this._tooltipContent.setAttribute("x",c[3]),this._tooltipContent.setAttribute("y",c[0]+v);let e=0;i.forEach(((i,n)=>{var o;const l=t.getContentAttr(this.attribute,n);if(!JG(l))return;const c=`tooltip-content-${n}`,d=this._tooltipContent.createOrUpdateChild(c,{visible:!0,x:0,y:e},"group");let u=0;if(JG(l.shape)&&d.createOrUpdateChild(`${c}-shape`,Object.assign({visible:!0,x:l.shape.size/2,y:l.shape.size/2+((null!==(o=l.key.lineHeight)&&void 0!==o?o:l.key.fontSize)-l.shape.size)/2},l.shape),"symbol"),a&&(u+=l.shape.size+l.shape.spacing),JG(l.key)){let t;t=l.key.multiLine?d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},DX(l.key)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-key`,Object.assign(Object.assign({visible:!0},l.key),{textBaseline:"top"}),"text");const{textAlign:e}=l.key;"center"===e?t.setAttribute("x",u+s/2):"right"===e||"end"===e?t.setAttribute("x",u+s):t.setAttribute("x",u),t.setAttribute("y",0),u+=s+l.key.spacing}if(JG(l.value)){let t;t=l.value.multiLine?d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},DX(l.value)),{textBaseline:"top"}),"richtext"):d.createOrUpdateChild(`${c}-value`,Object.assign(Object.assign({visible:!0},l.value),{textBaseline:"top"}),"text");let e="right";h(l.value.textAlign)?e=l.value.textAlign:JG(l.key)||(e="left"),t.setAttribute("textAlign",e),"center"===e?t.setAttribute("x",u+r/2):"right"===e||"end"===e?t.setAttribute("x",u+r):t.setAttribute("x",u),u+=r,t.setAttribute("y",0),d.add(t)}e+=l.height+l.spaceRow}))}}setAttributes(e,i){const n=Object.keys(e);this.attribute.autoCalculatePosition&&n.every((t=>FX.includes(t)))?(this._mergeAttributes(e,n),l(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:n,offsetY:s,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+n:"center"===o?c-=e/2:c+=n,"top"===l?d-=i+s:"middle"===l?d-=i/2:d+=s,c+e>h.x2&&(c-=e+n),d+i>h.y2&&(d-=i+s),c{const r=t.getContentAttr(e,n);(i.key||i.value)&&JG(r)&&s.push([i,r])})),s.length){let t=!1;const r=[],l=[],h=[];s.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,v=JG(g),m=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=pU(u),_=pU(p);let b=0;if(JG(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(JG(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}v&&TR[m]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+s[1]+s[3],e.panel.height=o,e}static getTitleAttr(e){return IX({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return IX({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};jX.defaultAttributes=LX;const zX={axis:{label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},length:100,type:"line"},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],start:{x:0,y:0},end:{x:100,y:0},x:0,y:0},circleAxis:{title:{space:4,padding:[0,0,0,0],textStyle:{fontSize:12,fill:"#333333",fontWeight:"normal",fillOpacity:1},text:"theta"},label:{visible:!0,inside:!1,space:4,style:{fontSize:12,fill:"#6F6F6F",fontWeight:"normal",fillOpacity:1}},tick:{visible:!0,inside:!1,alignWithLabel:!0,length:4,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},subTick:{visible:!1,inside:!1,count:4,length:2,style:{lineWidth:1,stroke:"#D8DCE3",strokeOpacity:1}},line:{visible:!0,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1}},grid:{style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]},type:"line",visible:!1,smoothLink:!0},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#dfdfdf",strokeOpacity:1,lineDash:[4,4]}},items:[],startAngle:0,endAngle:2*Math.PI,radius:100,innerRadius:0,center:{x:0,y:0},x:0,y:0},discreteLegend:{layout:"vertical",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:10,spaceRow:10,shape:{space:4,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",stroke:"#D8D8D8",fillOpacity:.5}}},label:{space:4,style:{fontSize:12,fill:"black",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8",fillOpacity:.5}}},value:{alignRight:!1,style:{fontSize:12,fill:"#ccc",cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{fill:"#D8D8D8"}}},background:{style:{cursor:"pointer"},state:{selectedHover:{fillOpacity:.7,fill:"gray"},unSelectedHover:{fillOpacity:.2,fill:"gray"}}},focus:!1,focusIconStyle:{size:10,fill:"#333",cursor:"pointer"},visible:!0,padding:{top:2,bottom:2,left:2,right:2}},autoPage:!0,pager:{space:12,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!1,items:[{index:0,id:"",label:"",shape:{fill:"#6690F2",stroke:"#6690F2",symbolType:"circle"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{layout:"horizontal",railWidth:200,railHeight:10,railStyle:{cornerRadius:5},range:{draggableTrack:!0},startText:{visible:!0,text:"",space:8},endText:{visible:!0,text:"",space:8},min:0,max:1,value:[0,1]},dataLabel:{size:{width:400,height:400},dataLabels:[]},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!0,clampForce:!1,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",data:{}}],width:800,height:600,position:"outside",zIndex:302},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{}};class HX extends XG{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}}RW(DV.lineAxis,((t,e)=>new CY(t,e))),RW(DV.circleAxis,(t=>new PY(t)));class NX extends HX{constructor(t,e,i){super(t,BV.axis,e),this.spec.componentType=BV.axis,this.spec.axisType="line",this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=D({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),n=PW(this._getAxisComponentType()).creator(i,this.mode);return super.addGraphicItem(i,e,n)}tickCount(t){return this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r,a,o,l;let h=kW(s,e,i,n);const c=kV(this.spec.inside,n,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);if(d){const s=t.getCoordinateAxisPosition();"auto"===(null===(a=this.spec.layout)||void 0===a?void 0:a.position)&&(this.spec.layout.position=c?"content":s);const r=kV(this.spec.baseValue,n,e,i),l=t.getCoordinateAxisPoints(r);if(l){const e=l[0],i=l[1];h=Object.assign({},{start:e,end:i,verticalFactor:("top"===s||"left"===s?-1:1)*(c?-1:1)*((null===(o=t.getSpec().range)||void 0===o?void 0:o.reversed)?-1:1)},h)}else{const t=d.radius(),e=d.angle();h=Object.assign({},{center:d.origin(),radius:t[1],innerRadius:t[0],inside:c,startAngle:e[0],endAngle:e[1]},h)}}const u=null===(l=null==t?void 0:t.getScale)||void 0===l?void 0:l.call(t),p=kV(this.spec.tickCount,n,e,i);switch(this._getAxisComponentType()){case DV.lineAxis:return((t,e,i)=>{var n,s;const r=zX.axis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p);case DV.circleAxis:return((t,e,i)=>{var n,s;const r=zX.circleAxis;return t?D({},r,{items:[(null!==(s=null===(n=t.tickData)||void 0===n?void 0:n.call(t,i))&&void 0!==s?s:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=e?e:{}):D({},r,null!=e?e:{})})(u,h,p)}return h}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(l(e)){const i=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?DV.circleAxis:DV.lineAxis,this._axisComponentType}}RW(LV.discreteLegend,(t=>new sX(t))),RW(LV.colorLegend,(t=>new hX(t))),RW(LV.sizeLegend,(t=>new dX(t)));class VX extends HX{constructor(t,e){super(t,BV.legend,e),this.spec.componentType=BV.legend,this.spec.legendType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.legendType(t.legendType),this}legendType(t){return this.spec.legendType=t,this._legendComponentType=null,this._prepareRejoin(),this.commit(),this}isContinuousLegend(){return this._getLegendComponentType()!==LV.discreteLegend}target(t,e){var i;const n=this.isContinuousLegend(),s=n?"change":QY.legendItemClick,r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r;a&&this.view.removeEventListener(s,this._filterCallback),this.spec.target=void 0;const o=g(t)?this.view.getDataById(t):t,l=g(e)?n?(t,i)=>t[e]>=i.start&&t[e]<=i.end:(t,i)=>i.includes(t[e]):e;return this._filterData(a,o,IV.legend,(t=>n?{start:t.detail.value[0],end:t.detail.value[1]}:t.detail.currentSelected),l),o&&(this.view.addEventListener(s,this._filterCallback),this.spec.target={data:o,filter:e}),this}setSelected(t){var e,i;return(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)).setSelected(t),this}addGraphicItem(t,e){const i=PW(this._getLegendComponentType()).creator(t);return super.addGraphicItem(t,e,i)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,n)=>{const s=e[n];return s&&(i[n]={callback:(e,i,n)=>{var r;const a=kW(s,e,i,n),o=null===(r=null==t?void 0:t.getScale)||void 0===r?void 0:r.call(t);switch(this._getLegendComponentType()){case LV.discreteLegend:return((t,e)=>{const i=zX.discreteLegend;return t?D({},i,{items:Array.from(new Set(V(t.domain()))).map(((e,i)=>{const n=t.scale(e),s=EV(n),r=s?Object.assign(Object.assign({},zX.discreteLegend.items[0].shape),{fill:s,stroke:s}):zX.discreteLegend.items[0].shape;return{label:e.toString(),id:e,shape:r,index:i}}))},null!=e?e:{}):D({},i,null!=e?e:{})})(o,a);case LV.colorLegend:return((t,e)=>{const i=zX.colorLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{colors:t.range().slice(),min:n[0],max:W(n)},null!=e?e:{})})(o,a);case LV.sizeLegend:return((t,e)=>{const i=zX.sizeLegend;if(!t)return D({},i,null!=e?e:{});const n=t.domain();return D({},i,{min:n[0],max:n[n.length-1],value:[n[0],n[n.length-1]]},null!=e?e:{})})(o,a)}return a}}),i}),{});this._encoders=i}_getLegendComponentType(){var t;if(this._legendComponentType)return this._legendComponentType;if(this.spec.legendType&&"auto"!==this.spec.legendType)this._legendComponentType="color"===this.spec.legendType?"colorLegend":"size"===this.spec.legendType?"sizeLegend":"discreteLegend";else{const e=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,i=null===(t=null==e?void 0:e.getScaleType)||void 0===t?void 0:t.call(e);if(i&&ol(i)){const t=e.getScale().range();EV(null==t?void 0:t[0])?this._legendComponentType=LV.colorLegend:this._legendComponentType=LV.sizeLegend}else this._legendComponentType=LV.discreteLegend}return this._legendComponentType}}RW(FV.lineCrosshair,(t=>new EU(t))),RW(FV.rectCrosshair,(t=>new PU(t))),RW(FV.sectorCrosshair,(t=>new OU(t))),RW(FV.circleCrosshair,(t=>new RU(t))),RW(FV.polygonCrosshair,(t=>new BU(t))),RW(FV.ringCrosshair,(t=>new OU(t)));const WX=function(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;var a,o;const l={x:0,y:0},h={x:0,y:0},c="angle"===i?null!==(a=null==s?void 0:s.radius)&&void 0!==a?a:Math.min(n.width,n.height)/2:null,d="angle"===i?null!==(o=null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2}:null;let u=0;if(hl(e.type)){if("x"===i)u=e.scale(e.invert(t.x));else if("y"===i)u=e.scale(e.invert(t.y));else if("angle"===i){const i=Zt(te(d,t)+2*Math.PI);u=e.scale(e.invert(i))}}else ol(e.type)&&("x"===i?u=t.x:"y"===i?u=t.y:"angle"===i&&(u=te(d,t)));switch(u+=r,i){case"x":l.x=u,l.y=0,h.x=u,h.y=n.height;break;case"y":l.x=0,l.y=u,h.x=n.width,h.y=u;break;case"angle":l.x=d.x,l.y=d.y,h.x=d.x+c*Math.cos(u),h.y=d.y+c*Math.sin(u)}return{start:l,end:h}},GX=(t,e,i,n,s,r)=>{var a,o,l;const h=null!==(o=null!==(a=null==r?void 0:r.center)&&void 0!==a?a:null==s?void 0:s.center)&&void 0!==o?o:{x:n.width/2,y:n.height/2};let c=0;if(hl(e.type)){const i="band"===e.type?e.bandwidth()/2:0,n=Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2);c=e.scale(e.invert(n))+i}else if(ol(e.type)){const e=null!==(l=null==s?void 0:s.radius)&&void 0!==l?l:Math.min(n.width,n.height)/2;c=Math.min(e,Math.sqrt((t.x-h.x)**2+(t.y-h.y)**2))}return{radius:c,center:h}};class UX extends HX{constructor(t,e){super(t,BV.crosshair,e),this._onCrosshairShow=t=>{var e,i,n,s;if(!(null===(i=null===(e=this.elements[0])||void 0===e?void 0:e.getGraphicItem)||void 0===i?void 0:i.call(e)))return;const r=this.group.getGroupGraphicItem(),a={x:0,y:0};if(r.globalTransMatrix.transformPoint(t.canvas,a),a.x<0||a.x>r.attribute.width||a.y<0||a.y>r.attribute.height)return;const o=this.elements[0].getGraphicItem(),l=null!==(n=this.spec.crosshairType)&&void 0!==n?n:"x",h={width:r.attribute.width,height:r.attribute.height},c=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),d=this.spec.componentConfig,u=null!==(s=this._additionalEncodeResult)&&void 0!==s?s:{};let p={};switch(this._getCrosshairComponentType()){case FV.lineCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.lineCrosshair,h="band"===e.type?e.bandwidth()/2:0;return D({},l,WX(t,e,i,n,{radius:null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius,center:null!==(o=null==r?void 0:r.center)&&void 0!==o?o:null==s?void 0:s.center},h),null!=r?r:{})})(a,c,l,h,d,u);break;case FV.rectCrosshair:p=((t,e,i,n,s,r)=>{var a,o;const l=zX.rectCrosshair,h="band"===e.type||"point"===e.type?e.step():void 0,c=null==r?void 0:r.rectStyle,d=null!=h?h:"y"===i?null!==(a=null==c?void 0:c.width)&&void 0!==a?a:l.rectStyle.width:null!==(o=null==c?void 0:c.height)&&void 0!==o?o:l.rectStyle.height,u=WX(t,e,i,n,s,"band"===e.type?0:-d/2),p={};"x"===i?p.width=d:p.height=d;const g=D({},l,{start:u.start,end:u.end,rectStyle:p},null!=r?r:{});return"x"===i?g.rectStyle.height=g.end.y-g.start.y:g.rectStyle.width=g.end.x-g.start.x,g})(a,c,l,h,d,u);break;case FV.sectorCrosshair:p=((t,e,i,n,s,r)=>{var a,o,l,h;const c=zX.sectorCrosshair,d=null!==(o=null!==(a=null==r?void 0:r.radius)&&void 0!==a?a:null==s?void 0:s.radius)&&void 0!==o?o:Math.min(n.width,n.height)/2,u=null!==(h=null!==(l=null==r?void 0:r.center)&&void 0!==l?l:null==s?void 0:s.center)&&void 0!==h?h:{x:n.width/2,y:n.height/2},p=c.endAngle-c.startAngle,g="band"===e.type||"point"===e.type?e.step():p;let f=0;if(hl(e.type)){const i=Zt(te(u,t)+2*Math.PI);f=e.scale(e.invert(i))+("band"===e.type?e.bandwidth()/2:0)}else ol(e.type)&&(f=te(u,t));return D({},c,{center:u,radius:d,startAngle:f-g/2,endAngle:f+g/2},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.circleCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.polygonCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r);return D({},a,{center:o,radius:l,startAngle:a.startAngle,endAngle:a.endAngle},null!=r?r:{})})(a,c,0,h,d,u);break;case FV.ringCrosshair:p=((t,e,i,n,s,r)=>{const a=zX.circleCrosshair,{center:o,radius:l}=GX(t,e,0,n,s,r),h=a.startAngle,c=a.endAngle,d="band"===e.type||"point"===e.type?e.step():0;return D({},a,{center:o,innerRadius:l-d/2,radius:l+d/2,startAngle:h,endAngle:c},null!=r?r:{})})(a,c,0,h,d,u)}o.showAll(),o.setAttributes(p)},this._onCrosshairHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.crosshair,this.spec.crosshairShape="line",this.spec.crosshairType="x"}parseAddition(t){return super.parseAddition(t),this.crosshairType(t.crosshairType),this.crosshairShape(t.crosshairShape),this}crosshairType(t){return this.spec.crosshairType=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}crosshairShape(t){return this.spec.crosshairShape=t,this._crosshairComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=Object.assign(this._getDefaultCrosshairAttribute(),t),n=PW(this._getCrosshairComponentType()).creator(i);return super.addGraphicItem(i,e,n)}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onCrosshairShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onCrosshairHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onCrosshairShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onCrosshairHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onCrosshairShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onCrosshairHide),this._lastGroup=l}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_getCrosshairComponentType(){var t,e;if(this._crosshairComponentType)return this._crosshairComponentType;const i=null!==(t=this.spec.crosshairShape)&&void 0!==t?t:"line",n=null!==(e=this.spec.crosshairType)&&void 0!==e?e:"x";return this._crosshairComponentType="rect"===i?"angle"===n?FV.sectorCrosshair:"radius"===n?FV.ringCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.rectCrosshair:"radius"===n?FV.circleCrosshair:"radius-polygon"===n?FV.polygonCrosshair:FV.lineCrosshair,this._crosshairComponentType}_getDefaultCrosshairAttribute(){var t;const e=null!==(t=this.spec.crosshairType)&&void 0!==t?t:"x";return"radius"===e||"radius-polygon"===e?{center:{x:0,y:0}}:{start:{x:0,y:0},end:{x:0,y:0}}}}RW(BV.slider,(t=>new lX(t)));class YX extends XG{constructor(t,e){super(t,BV.slider,e),this.spec.componentType=BV.slider}parseAddition(t){var e,i;return super.parseAddition(t),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.min(t.min),this.max(t.max),this}min(t){return this.setFunctionSpec(t,"min")}max(t){return this.setFunctionSpec(t,"max")}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data,s=g(n)?this.view.getDataById(n):n;s&&this.view.removeEventListener("change",this._filterCallback),this.spec.target=void 0;const r=g(t)?this.view.getDataById(t):t,a=g(e)?(t,i)=>t[e]>=i.start&&t[e]<=i.end:e;return this._filterData(s,r,IV.slider,(t=>({start:t.detail.value[0],end:t.detail.value[1]})),a),r&&(this.view.addEventListener("change",this._filterCallback),this.spec.target={data:r,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setValue([t,e]),this}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>((t,e,i)=>D({},zX.slider,{min:t,max:e,value:[t,e]},null!=i?i:{}))(l(this.spec.min)?0:kV(this.spec.min,i,t,e),l(this.spec.max)?1:kV(this.spec.max,i,t,e),kW(n,t,e,i))}),e}),{});this._encoders=e}}RW(BV.label,(t=>new rY(t)));let XX=class extends XG{constructor(t,e){super(t,BV.label,e),this.spec.componentType=BV.label}parseAddition(t){return super.parseAddition(t),this.labelStyle(t.labelStyle),this.size(t.size),this.target(t.target),this}labelStyle(t){return this.setFunctionSpec(t,"labelStyle")}size(t){return this.setFunctionSpec(t,"size")}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t)),o=null===(r=null===(s=this.group)||void 0===s?void 0:s.getGroupGraphicItem)||void 0===r?void 0:r.call(s);let h=kV(this.spec.size,i);return h||(h=o?{width:o.attribute.width,height:o.attribute.height}:{width:1/0,height:1/0}),((t,e,i,n,s)=>{const r=zX.dataLabel,a=t.map((t=>{var e;let r={};switch(t.markType){case OV.line:r=zX.lineLabel;break;case OV.rect:r=zX.rectLabel;break;case OV.symbol:case OV.circle:r=zX.symbolLabel;break;case OV.arc:r=zX.arcLabel;break;default:return null}const a=[];t.graphicItem.forEachChildren((t=>{if("willRelease"!==t.releaseStatus){const e=t[WV],n=kW(i,e.getDatum(),e,s),o=D({},r.data[0],n);a.push(o)}}));const o=kV(n,s,t),l=null===(e=t.graphicItem)||void 0===e?void 0:e.name;return D({},r,{data:a,baseMarkGroupName:l},null!=o?o:{})})).filter((t=>!l(t)));return D({},r,{size:e,dataLabels:a})})(a,h,n,this.spec.labelStyle,i)}}),e}),{});this._encoders=e}};RW(BV.datazoom,(t=>new IY(t)));class $X extends XG{constructor(t,e){super(t,BV.datazoom,e),this.spec.componentType=BV.datazoom}parseAddition(t){var e,i,n,s,r,a,o;return super.parseAddition(t),this.preview(null===(e=t.preview)||void 0===e?void 0:e.data,null===(i=t.preview)||void 0===i?void 0:i.x,null===(n=t.preview)||void 0===n?void 0:n.y,null===(s=t.preview)||void 0===s?void 0:s.x1,null===(r=t.preview)||void 0===r?void 0:r.y1),this.target(null===(a=t.target)||void 0===a?void 0:a.data,null===(o=t.target)||void 0===o?void 0:o.filter),this._updateComponentEncoders(),this}preview(t,e,i,n,s){if(!l(this.spec.preview)){const t=this.spec.preview.data,e=g(t)?this.view.getDataById(t):t;this.detach(e),this.detach(hW(this.spec.preview.x,this.view)),this.detach(hW(this.spec.preview.y,this.view)),this.detach(hW(this.spec.preview.x1,this.view)),this.detach(hW(this.spec.preview.y1,this.view))}if(this.spec.preview=void 0,t){this.spec.preview={data:t,x:e,y:i,x1:n,y1:s};const r=g(t)?this.view.getDataById(t):t;this.attach(r),this.attach(hW(e,this.view)),this.attach(hW(i,this.view)),this.attach(hW(n,this.view)),this.attach(hW(s,this.view))}return this._updateComponentEncoders(),this.commit(),this}target(t,e){var i,n,s;const r=null===(i=this.spec.target)||void 0===i?void 0:i.data,a=g(r)?this.view.getDataById(r):r,o=null===(s=null===(n=this.elements[0])||void 0===n?void 0:n.getGraphicItem)||void 0===s?void 0:s.call(n);a&&o&&o.setUpdateStateCallback(null),this.spec.target=void 0;const h=g(t)?this.view.getDataById(t):t,c=g(e)?(t,i)=>{if(l(i.start)||l(i.end))return!0;const n=this._getDatazoomMainScale(),s=n.range(),r=(n.scale(t[e])-s[0])/(s[s.length-1]-s[0]);return i.startRatio<=r&&i.endRatio>=r}:e;return this._filterData(a,h,IV.datazoom,(t=>{const e=t.start,i=t.end;return{startRatio:e,endRatio:i,start:this._invertDatazoomRatio(e),end:this._invertDatazoomRatio(i)}}),c),h&&o&&(o.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),this.spec.target={data:h,filter:e}),this}setStartEndValue(t,e){var i,n;return(null===(n=null===(i=this.elements[0])||void 0===i?void 0:i.getGraphicItem)||void 0===n?void 0:n.call(i)).setStartAndEnd(t,e),this}addGraphicItem(t,e){const i=Object.assign({},zX.datazoom,t),n=PW(this.componentType).creator(i),s=n;return this._filterCallback&&s.setUpdateStateCallback(((t,e)=>{this._filterCallback({start:t,end:e},this.elements[0])})),s.setStatePointToData((t=>{var e;return this.spec.preview&&null!==(e=this._invertDatazoomRatio(t))&&void 0!==e?e:t})),s.setPreviewCallbackX((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x:this.spec.preview.x},t,this.elements[0],this.parameters()).x})),s.setPreviewCallbackY((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y:this.spec.preview.y},t,this.elements[0],this.parameters()).y})),s.setPreviewCallbackX1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.x1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({x1:this.spec.preview.x1},t,this.elements[0],this.parameters()).x1})),s.setPreviewCallbackY1((t=>{var e,i;if((null===(e=this.spec.preview)||void 0===e?void 0:e.y1)&&(null===(i=this.spec.preview)||void 0===i?void 0:i.data))return kW({y1:this.spec.preview.y1},t,this.elements[0],this.parameters()).y1})),super.addGraphicItem(i,e,n)}_updateComponentEncoders(){var t;const e=null===(t=this.spec.preview)||void 0===t?void 0:t.data,i=g(e)?this.view.getDataById(e):e,n=Object.assign({update:{}},this.spec.encode),s=Object.keys(n).reduce(((t,e)=>{const s=n[e];return s&&(t[e]={callback:(t,e,n)=>{var r;const a=kW(s,t,e,n);return((t,e)=>{const i=zX.datazoom;return t?D({},i,{previewData:t},null!=e?e:{}):D({},i,null!=e?e:{})})(null===(r=null==i?void 0:i.getValue)||void 0===r?void 0:r.call(i),a)}}),t}),{});this._encoders=s}_invertDatazoomRatio(t){const e=this._getDatazoomMainScale();if(e){const i=e.range(),n=(i[i.length-1]-i[0])*t+i[0];return e.invert(n)}return null}_getDatazoomMainScale(){var t,e,i,n;const s=null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t);if(s&&this.spec.preview){const t="top"===s.attribute.orient||"bottom"===s.attribute.orient?null===(i=this.spec.preview.x)||void 0===i?void 0:i.scale:null===(n=this.spec.preview.y)||void 0===n?void 0:n.scale,e=g(t)?this.view.getScaleById(t):t;return null==e?void 0:e.getScale()}return null}}RW(zV.continuousPlayer,(t=>new PX(t))),RW(zV.discretePlayer,(t=>new CX(t)));let KX=class extends XG{constructor(t,e){super(t,BV.player,e),this.spec.componentType=BV.player,this.spec.playerType="auto"}parseAddition(t){var e,i;return super.parseAddition(t),this.playerType(t.playerType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.source),this}playerType(t){return this.spec.playerType=t,this._playerComponentType=null,this._prepareRejoin(),this.commit(),this}target(t,e){var i,n,s;if(null===(i=this.spec.target)||void 0===i?void 0:i.source){const t=null===(n=this.spec.target)||void 0===n?void 0:n.source,e=f(t)?null:g(t)?this.view.getDataById(t):t;this.detach(e)}const r=f(e)?null:g(e)?this.view.getDataById(e):e;this.attach(r);const a=null===(s=this.spec.target)||void 0===s?void 0:s.data,o=g(a)?this.view.getDataById(a):a;o&&this.view.removeEventListener(SX.OnChange,this._filterCallback),this.spec.target=void 0;const l=g(t)?this.view.getDataById(t):t;return this._filterData(o,l,IV.player,(t=>({index:t.detail.index,value:t.detail.value})),void 0,((t,e)=>e.value)),l&&(this.view.addEventListener(SX.OnChange,this._filterCallback),this.spec.target={data:l,source:e}),this}play(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).play(),this}pause(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).pause(),this}backward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).backward(),this}forward(){var t,e;return(null===(e=null===(t=this.elements[0])||void 0===t?void 0:t.getGraphicItem)||void 0===e?void 0:e.call(t)).forward(),this}addGraphicItem(t,e,i){const n=D({slider:{handlerStyle:{size:16}}},t),s=null!=i?i:PW(this._getPlayerComponentType()).creator(n);return super.addGraphicItem(n,e,s)}release(){this._filterCallback&&this.view.removeEventListener("change",this._filterCallback),super.release()}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{var s,r;const a=kW(n,t,e,i),o=null===(s=this.spec.target)||void 0===s?void 0:s.source,l=f(o)?null:g(o)?this.view.getDataById(o):o,h=f(o)?o:null!==(r=null==l?void 0:l.getValue())&&void 0!==r?r:[];switch(this._getPlayerComponentType()){case"continuousPlayer":return((t,e)=>D({},zX.continuousPlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a);case"discretePlayer":return((t,e)=>D({},zX.discretePlayer,{data:t,dataIndex:0},null!=e?e:{}))(h,a)}}}),e}),{});this._encoders=e}_getPlayerComponentType(){return this._playerComponentType||(this.spec.playerType&&"auto"!==this.spec.playerType?this._playerComponentType="discrete"===this.spec.playerType?"discretePlayer":"continuous"===this.spec.playerType?"continuousPlayer":"discretePlayer":this._playerComponentType="discretePlayer"),this._playerComponentType}};RW(BV.tooltip,(t=>new jX(t))),RW(BV.dimensionTooltip,(t=>new jX(t)));const qX=(t,e,i,n,s)=>D({},zX.tooltip,{visible:!0,pointerX:t.x,pointerY:t.y,title:e,content:i,parentBounds:n},null!=s?s:{});class ZX extends XG{parseAddition(t){return super.parseAddition(t),this.title(t.title),this.content(t.content),this}title(t){return!this.spec.title||g(this.spec.title)||o(this.spec.title)||this.detach(this._parseTooltipRow(this.spec.title)),this.spec.title=t,!t||g(t)||o(t)||this.attach(this._parseTooltipRow(t)),this.commit(),this}content(t){return this.spec.content&&!o(this.spec.content)&&this.detach(this._parseTooltipRow(this.spec.content)),this.spec.content=t,t&&!o(t)&&this.attach(this._parseTooltipRow(t)),this.commit(),this}configureComponent(t){return super.configureComponent(t),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const n=t[i];return n&&(e[i]={callback:(t,e,i)=>{this._additionalEncodeResult=kW(n,t,e,i)}}),e}),{});this._encoders=e}_parseTooltipRow(t){return V(t).reduce(((t,e)=>(t=t.concat(wV(e.visible,this.view)),lW(e.key)||(t=t.concat(wV(e.key,this.view))),lW(e.value)||(t=t.concat(wV(e.value,this.view))),lW(e.symbol)||(t=t.concat(wV(e.symbol,this.view))),t)),[])}_computeTooltipRow(t,e,i){const n=this.elements[0];let s,r,a,o=kV(t.visible,i,e,n);return o=!!l(o)||!!o,s=lW(t.key)?Io(t.key.field)(e):kV(t.key,i,e,n),s=l(s)?void 0:d(s)?s:{text:s},r=lW(t.value)?Io(t.value.field)(e):kV(t.value,i,e,n),r=l(r)?void 0:d(r)?r:{text:r},a=lW(t.symbol)?Io(t.symbol.field)(e):kV(t.symbol,i,e,n),a=l(a)?void 0:d(a)?a:{symbolType:a},{visible:o,key:s,value:r,shape:a}}_computeTitleContent(t){const e=this.elements[0],i=this.parameters(),n=h(this.spec.title)?o(this.spec.title)?this.spec.title.call(null,t,e,i):this._computeTooltipRow(g(this.spec.title)?{value:this.spec.title}:this.spec.title,t,i):void 0,s=h(this.spec.content)?o(this.spec.content)?V(this.spec.content.call(null,t,e,i)):V(t).reduce(((t,e)=>t.concat(V(this.spec.content).map((t=>this._computeTooltipRow(t,e,i))))),[]):void 0;return{title:f(n)?n[0]:n,content:s}}}let JX=class extends ZX{constructor(t,e){super(t,BV.tooltip,e),this._targetMarks=[],this._onTooltipShow=mt(((t,e)=>{const i=this.elements[0].getGraphicItem();if(!this._targetMarks.includes(null==e?void 0:e.mark))return void i.hideAll();i.showAll();const n=this.group.getGroupGraphicItem(),s={x:0,y:0};if(n.globalTransMatrix.transformPoint(t.canvas,s),e===this._lastElement)return void i.setAttributes({pointerX:s.x,pointerY:s.y});const r={x:0,y:0};n.globalTransMatrix.transformPoint({x:0,y:0},r);const a={x:0,y:0};n.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},a);const o=(new $t).set(r.x,r.y,a.x,a.y),{title:l,content:h}=this._computeTitleContent(e.getDatum()),c=qX(s,l,h,o,this._additionalEncodeResult);i.setAttributes(c)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.tooltip}parseAddition(t){return super.parseAddition(t),this.target(t.target),this}target(t){if(this.spec.target){const t=V(this.spec.target).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.target=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._targetMarks=e.filter((t=>!l(t))),this.commit(),this}release(){this.view.removeEventListener("pointermove",this._onTooltipShow),this.view.removeEventListener("pointerleave",this._onTooltipHide),super.release()}init(t,e){super.init(t,e),this.view.addEventListener("pointermove",this._onTooltipShow),this.view.addEventListener("pointerleave",this._onTooltipHide)}};class QX extends ZX{constructor(t,e){super(t,BV.dimensionTooltip,e),this._avoidMarks=[],this._tooltipDataFilter=null,this._onTooltipShow=mt(((t,e)=>{var i,n,s;const r=this.elements[0].getGraphicItem(),a=(g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale).getScale(),o=this.group.getGroupGraphicItem(),l={x:0,y:0};o.globalTransMatrix.transformPoint(t.canvas,l);const h={width:o.attribute.width,height:o.attribute.height};if(l.x<0||l.x>o.attribute.width||l.y<0||l.y>o.attribute.height)return void r.hideAll();const c=null===(n=null===(i=t.target)||void 0===i?void 0:i[WV])||void 0===n?void 0:n.mark;if(this._avoidMarks.includes(c))return void r.hideAll();const d=null===(s=this.spec.target)||void 0===s?void 0:s.data,u=d?g(d)?this.view.getDataById(d):d:null,p=u?u.getValue():[],f=((t,e,i,n,s)=>{var r,a;if("x"===i)return e.invert(t.x);if("y"===i)return e.invert(t.y);if("radius"===i){const i=null!==(r=null==s?void 0:s.center)&&void 0!==r?r:{x:n.width/2,y:n.height/2},a=Math.sqrt((i.x-t.x)**2+(i.y-t.y)**2);return e.invert(a)}if("angle"===i){const i=te(null!==(a=null==s?void 0:s.center)&&void 0!==a?a:{x:n.width/2,y:n.height/2},t);return e.invert(i)}return e.invert(t.x)})(l,a,this.spec.tooltipType,h,this.spec.componentConfig),v=this._tooltipDataFilter?p.filter((t=>this._tooltipDataFilter(t,f))):[];if(r.showAll(),((t,e)=>{const i=V(t),n=V(e);return i.length===n.length&&i.every((t=>n.includes(t)))&&n.every((t=>i.includes(t)))})(v,this._lastDatum))return void r.setAttributes({pointerX:l.x,pointerY:l.y});this._lastDatum=v;const m={x:0,y:0};o.globalTransMatrix.transformPoint({x:0,y:0},m);const y={x:0,y:0};o.globalTransMatrix.transformPoint({x:this.view.getSignalById("width").getValue(),y:this.view.getSignalById("height").getValue()},y);const _=(new $t).set(m.x,m.y,y.x,y.y),{title:b,content:x}=this._computeTitleContent(v),S=qX(l,b,x,_,this._additionalEncodeResult);r.setAttributes(S)}),10),this._onTooltipHide=t=>{this.elements[0].getGraphicItem().hideAll()},this.spec.componentType=BV.dimensionTooltip,this.spec.tooltipType="x"}parseAddition(t){var e,i;return super.parseAddition(t),this.scale(t.scale),this.tooltipType(t.tooltipType),this.target(null===(e=t.target)||void 0===e?void 0:e.data,null===(i=t.target)||void 0===i?void 0:i.filter),this.avoidMark(t.avoidMark),this}scale(t){if(this.spec.scale){const t=g(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=g(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this.commit(),this}tooltipType(t){return this.spec.tooltipType=t,this.commit(),this}target(t,e){var i;const n=null===(i=this.spec.target)||void 0===i?void 0:i.data;if(n){const t=g(n)?this.view.getDataById(n):n;this.detach(t),this.spec.target=void 0}const s=g(t)?this.view.getDataById(t):t;return this._tooltipDataFilter=g(e)?(t,i)=>i===t[e]:e,s&&(this.attach(s),this.spec.target={data:s,filter:e}),this.commit(),this}avoidMark(t){if(this.spec.avoidMark){const t=V(this.spec.avoidMark).map((t=>g(t)?this.view.getMarkById(t):t));this.detach(t)}this.spec.avoidMark=t;const e=V(t).map((t=>g(t)?this.view.getMarkById(t):t));return this.attach(e),this._avoidMarks=e.filter((t=>!l(t))),this.commit(),this}release(){var t,e,i,n;null===(e=null===(t=this._lastGroup)||void 0===t?void 0:t.off)||void 0===e||e.call(t,"pointermove",this._onTooltipShow),null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointerleave",this._onTooltipHide),super.release()}init(t,e){var i,n,s,r,a,o;super.init(t,e);const l=this.group?this.group.getGroupGraphicItem():t.defaultLayer;this._lastGroup!==l&&(null===(n=null===(i=this._lastGroup)||void 0===i?void 0:i.off)||void 0===n||n.call(i,"pointermove",this._onTooltipShow),null===(r=null===(s=this._lastGroup)||void 0===s?void 0:s.off)||void 0===r||r.call(s,"pointerleave",this._onTooltipHide)),null===(a=null==l?void 0:l.on)||void 0===a||a.call(l,"pointermove",this._onTooltipShow),null===(o=null==l?void 0:l.on)||void 0===o||o.call(l,"pointerleave",this._onTooltipHide),this._lastGroup=l}}var t$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class e$ extends kG{constructor(t,e){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>(this._input=t.values,this._input),this.relay=t=>t[0],this.evaluateSync=(t,e)=>{this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms),n=this.evaluateTransformSync(i,this.grammarSource?t:this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this},this._loadTasks=[],l(e)||this.ingest({values:e})}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,!1),this.values(t.values,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[];if(t.values){const n=wV(t.values,this.view)[0];n&&e.push(n),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values}})}else if(t.source){const n=[];V(t.source).forEach((t=>{const i=CV(t)?t:this.view.getDataById(t);i&&(e.push(i),n.push(i))})),n.length&&(i.push({type:"relay",transform:this.relay,options:n}),this.grammarSource=n[0])}return{transforms:i,refs:e}}evaluate(t,e){return t$(this,void 0,void 0,(function*(){this.view.emit(NV.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const n=yield this.evaluateTransform(i,this._input,e),s=this._evaluateFilter(n,e);return this.setValues(s),this._isLoaded=!0,this.view.emit(NV.AFTER_EVALUATE_DATA),this}))}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{values:t});return l(t)||(i.source=void 0),e?this.parseLoad(i):this}source(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=Object.assign({},this.spec,{source:t});return l(t)||(i.values=void 0),e?this.parseLoad(i):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=V(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=TG(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=TG(this.spec.transform,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.commit(),this}getValue(){return this._values}getInput(){return this._input}addDataFilter(t){return this._postFilters=this._postFilters.concat(V(t)),this._postFilters.sort(((t,e)=>{var i,n;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(n=e.rank)&&void 0!==n?n:0)})),this}removeDataFilter(t){const e=V(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function i$(t,e,i,n){let s,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),s=t[r],n(a,s)<0);)t[e]=s,e=r;return t[e]=a}function n$(t,e,i,n){const s=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,i$(t,e,s,n)}class s${constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}return this.nodes.push(t),i$(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),i$(this.nodes,e,0,this.compare),n$(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,n$(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class r${constructor(t){this.list=[],this.ids={},this.idFunc=t||Do}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}var a$=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class o${constructor(){this.grammars=[],this.logger=qe.getInstance(),this._curRank=0,this._committed=new r$((t=>t.uid)),this._heap=new s$(((t,e)=>t.qrank-e.qrank)),this._beforeRunner=null,this._afterRunner=null,this._isRunning=!1,this._updateCounter=0,this._finishFirstRender=!1}asyncCallback(t){return a$(this,void 0,void 0,(function*(){try{yield t(this)}catch(t){this.logger.error(t)}}))}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t.rank=++this._curRank}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const n=i.targets;n&&n.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}),!0)}}_enqueue(t){t.qrank=t.rank,this._heap.push(t)}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>l(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._isRunning?this._enqueue(t):this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>e.rankthis._enqueue(t))),this._committed=new r$((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){return a$(this,void 0,void 0,(function*(){if(this._beforeRunner&&(yield this.asyncCallback(this._beforeRunner)),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i,n,s=0;this.logger.canLogInfo()&&(i=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();try{for(;this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(e=t.run(),e&&e.then&&(e=yield e),this._logGrammarRunInfo(t),this._enqueueTargets(t),s+=1):this._enqueue(t)}catch(t){this._heap.clear(),n=t}return this._isRunning=!1,this.logger.canLogInfo()&&(i=Date.now()-i,this.logger.info(`> ${s} grammars; ${i} ms`)),n?this.logger.error(n):this._afterRunner&&(yield this.asyncCallback(this._afterRunner)),this._finishFirstRender=!0,!0}))}evaluateSync(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._isRunning=!0,this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t.rank===t.qrank?(t.runSync(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t);return this._isRunning=!1,this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const l$=(t,e,i,n,s)=>{const r=t=>{if(s||!t||n&&!n(t)||i.call(null,t),t.markType===OV.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}s&&(!t||n&&!n(t)||i.call(null,t))};r(t)};class h${constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(NV.AFTER_VRENDER_DRAW),this._view.emit(NV.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,n){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=n,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}canvas(){return this._stage?this._stage.window.getNativeHandler().nativeCanvas:null}context(){return this._stage?this._stage.window.getContext().nativeContext:null}combineIncrementalLayers(){return this._stage&&function(t){return dE(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{oM.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,n;return null===(n=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===n||n.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(NV.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(NV.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(NV.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(NV.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}release(){this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,n,s;this._view.emit(NV.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:function(t){return new oN(t)}({width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!!r.disableDirtyBounds,autoRender:!0,pluginList:r.pluginList});(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(NV.AFTER_CREATE_VRENDER_STAGE),this._view.emit(NV.BEFORE_CREATE_VRENDER_LAYER);const o=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(NV.AFTER_CREATE_VRENDER_LAYER),(null===(n=this._eventConfig)||void 0===n?void 0:n.drag)&&(this._dragController=new PC(o)),null===(s=this._eventConfig)||void 0===s?void 0:s.gesture){const t=c(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new BC(o,t)}return{stage:a,layer:o}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}class c$ extends kG{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?kV(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(f(t)&&f(this.value)&&t.length===this.value.length){for(let e=0;e{const n=p$(t,e);n.length&&i.push(n[0])})),i}return[]}(t,e):f$(t)?function(t,e){var i;if(g(t.coordinate)){const i=e.getCoordinateById(t.coordinate);return i?[i]:[]}return"coordinate"===(null===(i=t.coordinate)||void 0===i?void 0:i.grammarType)?[t.coordinate]:[]}(t,e):wV(t,e)}function y$(t,e,i){if(l(e))return[];switch(t){case"linear":return function(t,e){let i=[];return i=i.concat(wV(t.nice,e)),i=i.concat(wV(t.niceMin,e)),i=i.concat(wV(t.niceMax,e)),i=i.concat(wV(t.min,e)),i=i.concat(wV(t.max,e)),i=i.concat(wV(t.zero,e)),i=i.concat(wV(t.roundRange,e)),i}(e,i);case"ordinal":return[];case"band":return function(t,e){return v$(t,e).concat(wV(t.paddingInner,e))}(e,i);case"point":return function(t,e){return v$(t,e)}(e,i)}return[]}function _$(t,e,i){const n=kV(t.nice,i,e);!0===n?e.nice():_(n)&&e.nice(n)}function b$(t,e,i){const n=kV(t.niceMax,i,e);!0===n?e.niceMax():_(n)&&e.niceMax(n);const s=kV(t.niceMin,i,e);!0===s?e.niceMin():_(s)&&e.niceMin(s)}function x$(t,e,i){const n=kV(t.min,i,e),s=kV(t.max,i,e),r=kV(t.zero,i,e),a=_(n),o=_(s),l=e.domain();if(2===l.length&&(a||o||r)){let t=Math.min(l[0],l[l.length-1]),i=Math.max(l[0],l[l.length-1]);r&&t>0?t=0:a&&(t=Math.min(t,n)),r&&i<0?i=0:o&&(i=Math.max(i,s)),e.domain([t,i],!0)}}function S$(t,e,i){kV(t.roundRange,i,e)&&e.rangeRound(e.range(),!0);const n=kV(t.config,i,e);(null==n?void 0:n.interpolate)&&e.interpolate(n.interpolate,!0),l(null==n?void 0:n.clamp)||(o(n.clamp)?e.clamp(!0,n.clamp,!0):e.clamp(n.clamp,void 0,!0))}function w$(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i),S$(t,e,i)}function A$(t,e,i){t.round&&e.round(kV(t.round,i,e),!0),t.padding&&e.padding(kV(t.padding,i,e),!0),t.paddingInner&&e.paddingInner(kV(t.paddingInner,i,e),!0),t.paddingOuter&&e.paddingOuter(kV(t.paddingOuter,i,e),!0),t.align&&e.align(kV(t.align,i,e),!0)}function k$(t,e){const i=t.field,n=MV(t.data,e),s=[];if(f(i))i.forEach((t=>{const e=Io(t);n&&n.forEach((t=>{s.push(e(t))}))}));else{const t=Io(i);n&&n.forEach((e=>{s.push(t(e))}))}return s}function M$(t,e){let i=[];return t.datas.forEach((t=>{i=i.concat(k$(t,e))})),i}function C$(t,e,i,n){return i&&t.sort(i),ol(e.type)?(n&&t.filter((t=>y(t))),[Math.min.apply(null,t),Math.max.apply(null,t)]):t}function T$(t,e,i){if(u$(t.domain)?e.domain(C$(k$(t.domain,i),e,t.domain.sort,!0),!0):g$(t.domain)?e.domain(C$(M$(t.domain,i),e,t.domain.sort,!0),!0):e.domain(kV(t.domain,i,e),!0),u$(t.range))e.range(C$(k$(t.range,i),e),!0);else if(g$(t.range))e.range(C$(M$(t.range,i),e),!0);else if(f$(t.range)){const n=MV(t.range.coordinate,i);!function(t){switch(t){case al.Quantile:case al.Quantize:case al.Threshold:return!0;default:return!1}}(e.type)&&n&&e.range(n.getRangeByDimension(t.range.dimension,t.range.isSubshaft,t.range.reversed))}else e.range(kV(t.range,i,e),!0);switch(t.type){case"linear":w$(t,e,i),e.rescale();break;case"band":case"point":(function(t,e,i){A$(t,e,i)})(t,e,i),e.rescale();break;case"pow":(function(t,e,i){w$(t,e,i);const n=kV(t.exponent,i,e);n>0&&e.exponent(n)})(t,e,i),e.rescale();break;case"log":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i);const n=kV(t.base,i,e);n>0&&e.base(n)})(t,e,i),e.rescale();break;case"sqrt":(function(t,e,i){w$(t,e,i)})(t,e,i),e.rescale();break;case"symlog":(function(t,e,i){w$(t,e,i);const n=kV(t.constant,i,e);_(n)&&e.constant(n)})(t,e,i),e.rescale();break;case"time":case"utc":(function(t,e,i){_$(t,e,i),x$(t,e,i),S$(t,e,i)})(t,e,i),e.rescale();break;case"quantize":(function(t,e,i){_$(t,e,i),b$(t,e,i),x$(t,e,i)})(t,e,i),e.rescale();break;case"quantile":e.rescale()}}class E$ extends kG{constructor(t,e){super(t),this.grammarType="scale",this.spec.type=e,this.scale=d$(e)}parse(t){return super.parse(t),this.domain(t.domain),this.range(t.range),this.configure(t),this.commit(),this}evaluate(t,e){return this.view.emit(NV.BEFORE_EVALUATE_SCALE),this.spec.type||(this.spec.type="linear"),this.scale&&this.scale.type===this.spec.type||(this.scale=d$(this.spec.type)),T$(this.spec,this.scale,e),this.view.emit(NV.BEFORE_EVALUATE_SCALE),this}output(){return this.scale}getScaleType(){return this.spec.type}getScale(){return this.scale}ticks(t){var e,i,n;return null!==(n=null===(i=null===(e=this.scale)||void 0===e?void 0:e.tickData)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:[]}domain(t){return l(this.spec.domain)||this.detach(m$(this.spec.domain,this.view)),this.spec.domain=t,this.attach(m$(t,this.view)),this.commit(),this}range(t){return l(this.spec.range)||this.detach(m$(this.spec.range,this.view)),this.spec.range=t,this.attach(m$(t,this.view)),this.commit(),this}getCoordinateAxisPosition(){const t=this.spec.range,e=null==t?void 0:t.coordinate;if(!l(e)){const i=t.dimension,n=t.isSubshaft,s=t.reversed,r=this.parameters()[e];return null==r?void 0:r.getVisualPositionByDimension(i,n,s)}return null}getCoordinateAxisPoints(t){const e=this.spec.range,i=null==e?void 0:e.coordinate;if(!l(i)){const n=e.dimension,s=e.isSubshaft,r=e.reversed,a=this.parameters()[i];return null==a?void 0:a.getAxisPointsByDimension(n,s,r,t)}return null}getCoordinate(){const t=this.spec.range,e=null==t?void 0:t.coordinate;return l(e)?null:this.parameters()[e]}configure(t){return this.detach(y$(this.spec.type,t,this.view)),l(t)?this.spec={type:this.spec.type,domain:this.spec.domain,range:this.spec.range}:(Object.assign(this.spec,t),this.attach(y$(this.spec.type,t,this.view))),this.commit(),this}reuse(t){return t.grammarType!==this.grammarType||(this.scale=t.output()),this}clear(){super.clear(),this.scale=null}}let P$=-1;const R$=[FG,jG,NG,zG,HG,VG,WG],O$=t=>{var e,i,n,s;return y(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(n=null==t?void 0:t.left)&&void 0!==n?n:0,right:null!==(s=null==t?void 0:t.right)&&void 0!==s?s:0}},B$=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;return{reuse:null===(e=null==t?void 0:t.reuse)||void 0===e||e,morph:null===(i=null==t?void 0:t.morph)||void 0===i||i,morphAll:null!==(n=null==t?void 0:t.morphAll)&&void 0!==n&&n,animation:{easing:null!==(r=null===(s=null==t?void 0:t.animation)||void 0===s?void 0:s.easing)&&void 0!==r?r:eW,delay:null!==(o=null===(a=null==t?void 0:t.animation)||void 0===a?void 0:a.delay)&&void 0!==o?o:JV,duration:null!==(h=null===(l=null==t?void 0:t.animation)||void 0===l?void 0:l.duration)&&void 0!==h?h:ZV,oneByOne:null!==(d=null===(c=null==t?void 0:t.animation)||void 0===c?void 0:c.oneByOne)&&void 0!==d?d:tW,splitPath:null!==(p=null===(u=null==t?void 0:t.animation)||void 0===u?void 0:u.splitPath)&&void 0!==p?p:null},enableExitAnimation:null===(g=null==t?void 0:t.enableExitAnimation)||void 0===g||g}},I$=(t,e)=>(null==e?void 0:e.debounce)?vt(t,e.debounce):(null==e?void 0:e.throttle)?mt(t,e.throttle):t,D$=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:IG;const i={},n=t.split(":");if(2===n.length){const[t,s]=n;"#"===t[0]?(i.markId=t.slice(1),i.source=e):"@"===t[0]?(i.markName=t.slice(1),i.source=e):IW[t]?(i.markType=t,i.source=e):i.source=t===BG?BG:e,i.type=s}else 1===n.length&&(i.type=t,i.source=e);return i},L$={},F$=()=>L$;let j$=class extends YG{constructor(t,e){super(t,OV.group,e),this.children=[]}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===OV.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return yW.rect}evaluateJoin(t){if(!this.elements.length){const t=PG(this);t.updateData(YV,XV,(()=>""),this.view),this.elements=[t],this.elementMap.set(YV,t)}}};function z$(t,e){if(_(t))return t;const i=t.trim();if("auto"===i)return 0;if(i.endsWith("%")){const t=parseFloat(i.substring(0,i.length-1));return _(t)?t*e:0}return 0}function H$(t,e){return Math.min(t<0?t+e:t-1,e)}function N$(t,e,i){let n=H$(t,i),s=H$(e,i);if(_(t)||_(e)?_(t)?_(e)||(n=H$(Math.max(0,s-1),i)):s=H$(n+1,i):(n=1,s=2),n>s){const t=s;s=n,n=t}return{start:n,end:s}}const V$=(t,e,i,n)=>{const s=function(t,e,i){var n,s,r,a;const o=null!==(n=t.gridTemplateRows)&&void 0!==n?n:[i],l=null!==(s=t.gridTemplateColumns)&&void 0!==s?s:[e],h=null!==(r=t.gridRowGap)&&void 0!==r?r:0,c=null!==(a=t.gridColumnGap)&&void 0!==a?a:0,d=o.map((t=>z$(t,i))),u=l.map((t=>z$(t,e))),p=Math.max(0,d.reduce(((t,e)=>t-e),i)-d.length*h)/o.filter((t=>"auto"===t)).length,g=Math.max(0,u.reduce(((t,e)=>t-e),e)-u.length*c)/l.filter((t=>"auto"===t)).length;let f=0;const v=d.map(((t,e)=>{const i="auto"===o[e]?p:t,n=f;return f+=i+h,n}));v.push(f);let m=0;const y=u.map(((t,e)=>{const i="auto"===l[e]?g:t,n=m;return m+=i+c,n}));return y.push(m),{rows:v,columns:y,rowGap:h,columnGap:c}}(t.getSpec().layout,i.width(),i.height());null==e||e.forEach((t=>{const e=t.getSpec().layout;t.layoutBounds=function(t,e,i,n,s){const r=t.rows.length,a=t.columns.length,{start:o,end:l}=N$(e,i,r),{start:h,end:c}=N$(n,s,a),d=t.columns[o],u=t.columns[l]-(c===a?0:t.columnGap),p=t.rows[h],g=t.rows[c]-(l===r?0:t.rowGap);return(new Xt).set(d,p,u,g)}(s,e.gridRowStart,e.gridRowEnd,e.gridColumnStart,e.gridColumnEnd),t.commit()}))},W$={[BV.axis]:0,[BV.legend]:1,[BV.slider]:2,[BV.player]:3,[BV.datazoom]:4},G$=t=>{var e,i,n;return null!==(i=null===(e=t.getSpec().layout)||void 0===e?void 0:e.order)&&void 0!==i?i:"component"===t.markType&&null!==(n=W$[t.componentType])&&void 0!==n?n:1/0},U$=(t,e,i,n)=>{const s=i.clone(),r=t.getSpec().layout,a=Vo(r.maxChildWidth,s.width()),o=Vo(r.maxChildHeight,s.width());let l=0,h=0,c=0,d=0;e.forEach((t=>{const e=t.getSpec().layout,r=O$(e.padding),u=n.parseMarkBounds?n.parseMarkBounds(t.getBounds(),t):t.getBounds();if("top"===e.position||"bottom"===e.position){const t=Math.min(u.height()+r.top+r.bottom,o);"top"===e.position?s.y1+=t:s.y2-=t,u.x1i.x2&&(h=Math.max(h,u.x2-i.x2))}if("left"===e.position||"right"===e.position){const t=Math.min(u.width()+r.left+r.right,a);"left"===e.position?s.x1+=t:s.x2-=t,u.y1i.y2&&(d=Math.max(d,u.y2-i.y2))}"outside"===e.position&&(s.x1+=Math.max(i.x1-u.x1,0)+r.left,s.x2-=Math.max(u.x2-i.x2,0)+r.right,s.y1+=Math.max(i.y1-u.y1,0)+r.top,s.y2-=Math.max(u.y2-i.y2)+r.bottom)})),l>s.x1-i.x1&&li.x2-s.x2&&hs.y1-i.y1&&ci.y2-s.y2&&dG$(t)-G$(e)));for(let t=0,e=v.length;t{null==t||t.forEach((t=>{var n;if(t.markType!==OV.group)return;const s=t.layoutChildren,r=t.getSpec().layout,a=null!==(n=t.layoutBounds)&&void 0!==n?n:t.getBounds();if(a){if(o(r))r.call(null,t,s,a,e);else if(o(r.callback))r.callback.call(null,t,s,a,e);else if("relative"===r.display)if(r.updateViewSignals){const n=i.getViewBox();n&&a.intersect(n);const r=U$(t,s,a,e),o=r.width(),l=r.height(),h={top:r.y1,right:i.width()-r.x2,left:r.x1,bottom:i.height()-r.y2};i.updateSignal(zG,o),i.updateSignal(HG,l),i.updateSignal(NG,h)}else U$(t,s,a,e);else"grid"===r.display&&V$(t,s,a);Y$(s,e,i)}}))};class X$ extends YG{constructor(t,e,i){super(t,OV.glyph,i),this.glyphType=e,this.glyphMeta=uW(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=LW(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}}let $$=class{constructor(){this.startPoint={x:0,y:0},this.endPoint={x:0,y:0},this.originPoint={x:0,y:0},this.width=0,this.height=0,this.transforms=[]}start(t,e){return l(t)?this.startPoint:(this.startPoint=this._parsePoint(t,e),this._updateSize(),this)}end(t,e){return l(t)?this.endPoint:(this.endPoint=this._parsePoint(t,e),this._updateSize(),this)}_parsePoint(t,e){const i={x:0,y:0};return f(t)?(i.x=t[0],i.y=t[1]):y(t)?(i.x=t,i.y=e):(i.x=t.x,i.y=t.y),i}_updateSize(){this.width=this.endPoint.x-this.startPoint.x,this.height=this.endPoint.y-this.startPoint.y}isTransposed(){return this.transforms&&this.transforms.filter((t=>"transpose"===t.type)).length%2!=0}isMainDimension(t){let e="x"===t||"theta"===t||"0"===t;return this.isTransposed()&&(e=!e),e}applyTransforms(t){return this.transforms=t.slice(),this._invokeTransforms(),this}_invokeTransforms(){this.invertMatrix=null,this.convertMatrix=null,this.invertMatrix=new ee,this.invertMatrix.translate(this.originPoint.x,this.originPoint.y),this.transforms.forEach((t=>{switch(t.type){case"translate":this.invertMatrix.translate(t.offset.x,t.offset.y);break;case"rotate":this.invertMatrix.rotateByCenter(t.angle,this.originPoint.x,this.originPoint.y);break;case"scale":this.invertMatrix.scale(t.scale.x,t.scale.y);break;case"transpose":"polar"!==this.type&&this.invertMatrix.transpose()}})),this.invertMatrix,this.convertMatrix=this.invertMatrix.getInverse()}};class K$ extends $${constructor(){super(...arguments),this.type="cartesian"}convert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.convertPoint(t),s=this.convertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.convertPoint(t)}invert(t){var e,i;if(_(t.x1)||_(t.y1)){const n=this.invertPoint(t),s=this.invertPoint({x:null!==(e=t.x1)&&void 0!==e?e:t.x,y:null!==(i=t.y1)&&void 0!==i?i:t.y});return n.x1=s.x,n.y1=s.y,n}return this.invertPoint(t)}getRangeByDimension(t,e,i){const n=this.start(),s=this.end(),r=this.isMainDimension(t)?[n.x,s.x]:[s.y,n.y];return i?[r[1],r[0]]:r}getVisualPositionByDimension(t,e,i){return this.isMainDimension(t)?e?"top":"bottom":e?"right":"left"}getAxisPointsByDimension(t,e,i,n){const s=this.start(),r=this.end();if(this.isMainDimension(t)){const t=l(n)?e?[{x:s.x,y:s.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:r.x,y:r.y}]:[{x:s.x,y:n},{x:r.x,y:n}];return i?[t[1],t[0]]:t}const a=l(n)?e?[{x:r.x,y:r.y},{x:r.x,y:s.y}]:[{x:s.x,y:r.y},{x:s.x,y:s.y}]:[{x:n,y:r.y},{x:n,y:s.y}];return i?[a[1],a[0]]:a}convertPoint(t){const e=f(t)?{x:t[0],y:t[1]}:t,i=Object.assign({},e);return this.convertMatrix.transformPoint(e,i),i}invertPoint(t){const e=Object.assign({},t);return this.invertMatrix.transformPoint(t,e),e}}class q$ extends $${constructor(){super(...arguments),this.type="polar",this._isUserOrigin=!1,this._isUserRadius=!1,this.startAngle=0,this.endAngle=2*Math.PI,this.innerRadius=0,this.outerRadius=0}_updateStartEndPoint(){const t=this.origin(),e=Math.min(this.startAngle,this.endAngle),i=Math.max(this.startAngle,this.endAngle),n=2*e/Math.PI,s=2*i/Math.PI,r=[e,i];let a=Math.ceil(n);for(;a<=s;)r.push(a*Math.PI/2),a++;const o=r.length,l=[],h=[];for(a=0;a=0?2*Math.PI:Math.PI,s>=2*Math.PI&&(s-=2*Math.PI),s=Zt(s);const r=at(n,0)?i/Math.cos(s):n/Math.sin(s),a=this.isTransposed()?{r:s,theta:r}:{r:r,theta:s};return!1===e.defined&&(a.defined=!1),a}}function Z$(t){switch(t){case"cartesian":default:return new K$;case"polar":return new q$}}class J$ extends kG{constructor(t,e){super(t),this.grammarType="coordinate",this.spec={type:"cartesian"},this.spec.type=e,this.coordinate=Z$(e)}parse(t){return super.parse(t),this.start(t.start),this.end(t.end),this.origin(t.origin),this.translate(t.translate),this.rotate(t.rotate),this.scale(t.scale),this.transpose(t.transpose),this.commit(),this}evaluate(t,e){return this.coordinate&&this.coordinate.type===this.spec.type||(this.coordinate=Z$(this.spec.type)),function(t,e,i){var n,s,r,a,o,h,c;!l(t.start)&&e.start(null!==(n=kV(t.start,i))&&void 0!==n?n:[0,0]),!l(t.end)&&e.end(null!==(s=kV(t.end,i))&&void 0!==s?s:[0,0]),!l(t.origin)&&e.origin(null!==(r=kV(t.origin,i))&&void 0!==r?r:[0,0]);const d=[];if(!l(t.translate)){const e=kV(t.translate,i);d.push({type:"translate",offset:{x:null!==(a=null==e?void 0:e[0])&&void 0!==a?a:0,y:null!==(o=null==e?void 0:e[1])&&void 0!==o?o:0}})}if(!l(t.rotate)){const e=kV(t.rotate,i);d.push({type:"rotate",angle:null!=e?e:0})}if(!l(t.scale)){const e=kV(t.scale,i);d.push({type:"scale",scale:{x:null!==(h=null==e?void 0:e[0])&&void 0!==h?h:1,y:null!==(c=null==e?void 0:e[1])&&void 0!==c?c:1}})}l(t.transpose)||kV(t.transpose,i)&&d.push({type:"transpose"}),e.applyTransforms(d)}(this.spec,this.coordinate,e),this}output(){return this.coordinate}start(t){return this.setFunctionSpec(t,"start")}end(t){return this.setFunctionSpec(t,"end")}origin(t){return this.setFunctionSpec(t,"origin")}translate(t){return this.setFunctionSpec(t,"translate")}rotate(t){return this.setFunctionSpec(t,"rotate")}scale(t){return this.setFunctionSpec(t,"scale")}transpose(t){return this.setFunctionSpec(t,"transpose")}reuse(t){return t.grammarType!==this.grammarType||(this.coordinate=t.output()),this}clear(){super.clear(),this.coordinate=null}}const Q$=Symbol.for("key");class tK{diffGrammar(t,e){return function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i[0]}):l(i)?n.enter.push({next:e[0]}):n.update.push({next:e[0],prev:i[0]})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const n={enter:[],exit:[],update:[]};let s=[],r=[];t.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?s.push(t):n.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==OV.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):n.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(s,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));s=a.prev,r=a.next,n.update=n.update.concat(a.update);const o=this.diffUpdateByGroup(s,r,(t=>t.id()),(t=>t.id()));s=o.prev,r=o.next,n.update=n.update.concat(o.update);const l=nW(s,(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=nW(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)))}})),s.forEach((t=>n.exit.push({prev:[t]}))),r.forEach((t=>n.enter.push({next:[t]}))),n}_appendMorphKeyToElements(t){const e=t.getMorphConfig();if(!l(e.morphElementKey)){const i=TV(e.morphElementKey);t.elements&&t.elements.forEach((t=>{t.morphKey=i(t.getDatum())}))}}morph(t,e,i){const n=function(t,e,i){const n={enter:[],exit:[],update:[]},s=new sW(t,i);return s.setCallback(((t,e,i)=>{l(e)?n.exit.push({prev:i}):l(i)?n.enter.push({next:e}):n.update.push({next:e,prev:i})})),s.setCurrentData(nW(e,i)),s.doDiff(),n}(t.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),e.reduce(((t,e)=>(this._appendMorphKeyToElements(e),t.concat(e.elements))),[]),(t=>{var e;return null!==(e=t.morphKey)&&void 0!==e?e:t.key}));t.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)})),e.forEach((t=>{var e,i;return null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i?void 0:i.call(e)}));const s=t.concat(e).reduce(((t,e)=>(Object.assign(t,e.parameters()),t)),{});let r=0;const a=()=>{r-=1,0===r&&e.forEach((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)}))};n.enter.forEach((t=>{t.next.forEach((t=>{this.doMorph([],[t],i,a,s)})),r+=1})),n.update.forEach((t=>{const e=Math.min(t.prev.length,t.next.length),n=this.divideElements(t.prev,e),o=this.divideElements(t.next,e);for(let t=0;t{var e;return null!==(e=i(t))&&void 0!==e?e:Q$})),r=nW(e,(t=>{var e;return null!==(e=n(t))&&void 0!==e?e:Q$}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==Q$){const e=s.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}}doMorph(t,e,i,n,s){var r,a;const o={prev:t.map((t=>t.getDatum())),next:e.map((t=>t.getDatum()))},l={prev:t.slice(),next:e.slice()},h=i.animation.easing,c=kV(i.animation.delay,s,o,l),d=kV(i.animation.duration,s,o,l),u=kV(i.animation.oneByOne,s,o,l),p=kV(i.animation.splitPath,s,o,l),g=_(u)&&u>0?t=>y(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 n;const s=e.filter((t=>t&&t.toCustomPath&&t.valid));s.length||console.error(s," is not validate"),t.valid&&t.toCustomPath||console.error(t," is not validate");const r=("clone"===(null==i?void 0:i.splitPath)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(t,s.length,!1),a=null==i?void 0:i.onEnd;let o=s.length;const l=()=>{o--,0===o&&a&&a()};s.forEach(((e,n)=>{var a;const o=r[n],h=(null!==(a=null==i?void 0:i.delay)&&void 0!==a?a:0)+((null==i?void 0:i.individualDelay)?i.individualDelay(n,s.length,o,e):0);ZT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0].getGraphicItem(),e.map((t=>t.getGraphicItem())),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):t.length>1&&1===e.length&&((t,e,i)=>{var n,s,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)?eE:null!==(n=null==i?void 0:i.splitPath)&&void 0!==n?n:iE)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>XT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>KT(t.attribute,l)));if(null==i?void 0:i.individualDelay){const n=i.onEnd;let s=a.length;const r=()=>{s--,0===s&&(e.setAttributes({visible:!0,ratio:null},!1,{type:$A.ANIMATE_END}),e.detachShadow(),n&&n())};o.forEach(((e,n)=>{var s,o,l;const d=(null!==(s=i.delay)&&void 0!==s?s:0)+i.individualDelay(n,a.length,t[n],e),u=e.animate(Object.assign({},i,{onEnd:r}));u.wait(d),u.play(new qT({morphingData:h[n],saveOnEnd:!0,otherAttrs:c[n]},null!==(o=i.duration)&&void 0!==o?o:XC,null!==(l=i.easing)&&void 0!==l?l:$C))}))}else{const t=null==i?void 0:i.onEnd,n=i?Object.assign({},i):{};n.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$A.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(n);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new JT({morphingData:h,otherAttrs:c},null!==(s=null==i?void 0:i.duration)&&void 0!==s?s:XC,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$C))}})(t.map((t=>t.getGraphicItem())),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n,individualDelay:g,splitPath:p}):ZT(null===(a=null===(r=t[0])||void 0===r?void 0:r.getGraphicItem)||void 0===a?void 0:a.call(r),e[0].getGraphicItem(),{delay:c,duration:d,easing:h,onEnd:n})}divideElements(t,e){const i=Math.floor(t.length/e);return new Array(e).fill(0).map(((n,s)=>t.slice(i*s,s===e-1?t.length:i*(s+1))))}}class eK{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=g(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const n=t.grammarType,s=this._mapKey(t);return this._grammarMap[n]?(this._grammars[n].push(t),l(s)||(this._grammarMap[n][s]?null===(e=this._warning)||void 0===e||e.call(this,s,t):this._grammarMap[n][s]=t)):(this._grammars.customized.push(t),l(s)||(this._grammarMap.customized[s]?null===(i=this._warning)||void 0===i||i.call(this,s,t):this._grammarMap.customized[s]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),l(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),l(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]:null}getAllSignals(){return this._grammars.signal}getAllData(){return this._grammars.data}getAllScales(){return this._grammars.scale}getAllCoordinates(){return this._grammars.coordinate}getAllMarks(){return this._grammars.mark}getAllCustomized(){return this._grammars.customized}traverse(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}clear(){this._size=0,this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}}}release(){this._size=0,this._grammars=null,this._grammarMap=null}}class iK extends eK{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{const n=t.mark;n.markType===OV.group&&n.includesChild(e,!1)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===OV.group&&e.includesChild(n,!1)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class nK{constructor(t){this._animations=[],this._additionalAnimateMarks=[],this._onAnimationStart=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_START,{}),this._animations=this._animations.concat({config:t.animationConfig,mark:t.mark})},this._onAnimationEnd=t=>{this._additionalAnimateMarks=this._additionalAnimateMarks.filter((t=>{var e;return null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating()})),this._animations=this._animations.filter((e=>e.config!==t.animationConfig||e.mark!==t.mark)),0===this._animations.length&&0===this._additionalAnimateMarks.length&&this._view.emit(NV.ALL_ANIMATION_END,{})},this._view=t,this._view.addEventListener(NV.ANIMATION_START,this._onAnimationStart),this._view.addEventListener(NV.ANIMATION_END,this._onAnimationEnd)}stop(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}pause(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.pause)||void 0===i||i.call(e))})),this}resume(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.resume)||void 0===i||i.call(e))})),this}enable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.enable)||void 0===i||i.call(e)})),this}disable(){return this._view.traverseMarkTree((t=>{var e,i;null===(i=null===(e=t.animate)||void 0===e?void 0:e.disable)||void 0===i||i.call(e)})),this._additionalAnimateMarks.forEach((t=>{var e,i;t.view&&(null===(i=null===(e=t.animate)||void 0===e?void 0:e.stop)||void 0===i||i.call(e))})),this._additionalAnimateMarks=[],this}enableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.enableAnimationState)||void 0===n||n.call(i,t)})),this}disableAnimationState(t){return this._view.traverseMarkTree((e=>{var i,n;null===(n=null===(i=e.animate)||void 0===i?void 0:i.disableAnimationState)||void 0===n||n.call(i,t)})),this}isAnimating(){return 0!==this._animations.length||this._additionalAnimateMarks.some((t=>{var e;return(null===(e=null==t?void 0:t.animate)||void 0===e?void 0:e.isAnimating())||!1}))}animate(){return this._view.traverseMarkTree((t=>{t.isUpdated&&t.animate&&t.animate.animate(),t.cleanExitElements(),t.isUpdated=!1}),null,!0),this}animateAddition(t){return t.animate.animate(),this._additionalAnimateMarks.push(t),this}release(){this._additionalAnimateMarks=[],this._view.removeEventListener(NV.ALL_ANIMATION_START,this._onAnimationStart),this._view.removeEventListener(NV.ALL_ANIMATION_END,this._onAnimationEnd)}}class sK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{var r,a,o;const h=kW(e,t,i,s);if(this.disableCoordinateTransform=!1,n&&n.x&&n.x.type===al.Band){if(!l(n.y)){const t=n.y.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.y1=n.y.scale(s)}const t=n.x.bandwidth();h.x=h.x+t/4,h.x1=h.x+t/2}else if(n&&n.y&&n.y.type===al.Band){if(!l(n.x)){const t=n.x.domain(),e=Math.min.apply(null,t),i=Math.max.apply(null,t),s=e>0?e:i<0?i:0;h.x1=n.x.scale(s)}const t=n.y.bandwidth();h.y=h.y+t/4,h.y1=h.y+t/2}if(n){const t=(null!==(a=this.view.getScaleById(null===(r=e.x)||void 0===r?void 0:r.scale))&&void 0!==a?a:this.view.getScaleById(null===(o=e.y)||void 0===o?void 0:o.scale)).getCoordinate();if(t&&"polar"===t.type){this.disableCoordinateTransform=!0;const e=t.origin();h.cx=e.x,h.cy=e.y}}return h}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return this.coord&&"polar"===this.coord.output().type?[{channels:["x","y","x1","y1","cx","cy"],transform:(t,e,i)=>{t.x=i.cx,t.y=i.cy,this.coord.output().isTransposed()?(t.startAngle=i.y,t.endAngle=i.y1,t.innerRadius=i.x,t.outerRadius=i.x1):(t.startAngle=i.x,t.endAngle=i.x1,t.innerRadius=i.y,t.outerRadius=i.y1)},storedAttrs:"sizeAttrs"}]:yW.rect}addGraphicItem(t,e){const i=DW(this,this.coord&&"polar"===this.coord.output().type?OV.arc:OV.rect,t);return super.addGraphicItem(t,e,i)}release(){super.release(),this._encoders=null}}class rK extends YG{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),n=AV(e)?null:Object.keys(e).reduce(((t,n)=>(oW(e[n])&&(t[n]=MV(e[n].scale,i)),t)),{});this._encoders[t]={callback:(t,i,s)=>{const r=kW(e,t,i,s);if(l(r.size)){const t=n.x?CW(n.x):void 0,e=n.y?CW(n.y):void 0;l(t)&&l(e)?r.size=10:l(t)?r.size=e:l(e)&&(r.size=t),r.size=[t,e]}return l(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(y(i.padding)&&i.padding>0)t.size=f(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(f(i.padding)&&2===i.padding.length){const e=f(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(yW.symbol)}release(){super.release(),this._encoders=null}}var aK=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};class oK extends s{constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=vt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{var i;const n=null===(i=t.target)||void 0===i?void 0:i[WV],s=GG(0,t,n,e,IG);this.emit(e,s,n)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser",padding:5,cursor:!0},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}updateSignal(t,e){g(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new c$(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new e$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=new E$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}coordinate(t){const e=new J$(this,t);return this.grammars.record(e),this._dataflow.add(e),e}mark(t,e,i){const n=g(e)?this.getMarkById(e):e;let s;switch(t){case OV.group:s=new j$(this,n);break;case OV.glyph:s=new X$(this,null==i?void 0:i.glyphType,n);break;case OV.component:s=((t,e,i,n)=>{switch(e){case BV.axis:return new NX(t,i,n);case BV.legend:return new VX(t,i);case BV.crosshair:return new UX(t,i);case BV.slider:return new YX(t,i);case BV.label:return new XX(t,i);case BV.datazoom:return new $X(t,i);case BV.player:return new KX(t,i);case BV.tooltip:return new JX(t,i);case BV.dimensionTooltip:return new QX(t,i)}return new XG(t,e,i)})(this,null==i?void 0:i.componentType,n,null==i?void 0:i.mode);break;case OV.interval:s=new sK(this,t,n);break;case OV.cell:s=new rK(this,t,n);break;default:s=new YG(this,t,n)}return this.grammars.record(s),this._dataflow.add(s),s}group(t){return this.mark(OV.group,t)}glyph(t,e){return this.mark(OV.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(OV.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(OV.component,t,{componentType:BV.axis,mode:e})}legend(t){return this.mark(OV.component,t,{componentType:BV.legend})}crosshair(t){return this.mark(OV.component,t,{componentType:BV.crosshair})}slider(t){return this.mark(OV.component,t,{componentType:BV.slider})}label(t){return this.mark(OV.component,t,{componentType:BV.label})}datazoom(t){return this.mark(OV.component,t,{componentType:BV.datazoom})}player(t){return this.mark(OV.component,t,{componentType:BV.player})}tooltip(t){return this.mark(OV.component,t,{componentType:BV.tooltip})}dimensionTooltip(t){return this.mark(OV.component,t,{componentType:BV.dimensionTooltip})}customized(t,e){const i=(t=>L$[t])(t);if(i){const t=new i.grammarClass(this);return t.parse(e),this.grammars.record(t),this._dataflow.add(t),t}}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=g(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&R$.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}parseSpec(t){var e,i,n,s,r,a;if(this.emit(NV.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var n,s;t.group=e;const r=null!==(n=t.id)&&void 0!==n?n:"VGRAMMAR_MARK_"+ ++P$;t.id=r,(null!==(s=t.marks)&&void 0!==s?s:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),this.parseGlobalSpec(t),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(FG,t.width),this.updateSignal(jG,t.height))}(null===(e=t.signals)||void 0===e?void 0:e.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(i=t.data)||void 0===i?void 0:i.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(n=t.coordinates)||void 0===n?void 0:n.length)&&t.coordinates.forEach((t=>{this.coordinate(t.type).parse(t)})),(null===(s=t.scales)||void 0===s?void 0:s.length)&&t.scales.forEach((t=>{this.scale(t.type).parse(t)}));const o=F$();return Object.keys(o).forEach((e=>{var i;const{specKey:n}=o[e];(null===(i=t[n])||void 0===i?void 0:i.length)&&t[n].forEach((t=>{this.customized(e,t)}))})),(null===(r=t.marks)||void 0===r?void 0:r.length)&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),(null===(a=t.events)||void 0===a?void 0:a.length)&&t.events.forEach((t=>{this.event(t)})),this.emit(NV.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=HV.before,this}updateSpec(t){return this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e)=>{var i,n,s,r;return[{id:FG,value:null!==(i=t[FG])&&void 0!==i?i:0},{id:jG,value:null!==(n=t[jG])&&void 0!==n?n:0},{id:NG,value:O$(null!==(s=t[NG])&&void 0!==s?s:e[NG])},{id:zG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[FG]-i.left-i.right},dependency:[FG,NG]}},{id:HG,update:{callback:(t,e)=>{const i=O$(e[NG]);return e[jG]-i.top-i.bottom},dependency:[jG,NG]}},{id:VG,update:{callback:(t,e)=>{const i=O$(e[NG]);return(t||new Xt).setValue(i.left,i.top,i.left+e[zG],i.top+e[HG])},dependency:[zG,HG,NG]}},{id:WG,value:null!==(r=t[WG])&&void 0!==r?r:e[WG]}]})(this._options,this._config).map((t=>{const e=this.signal().parse(t);t.value&&e.set(t.value)})),this.parseMarkSpec({id:"root",type:"group",encode:{enter:{x:0,y:0},update:{width:{signal:"width"},height:{signal:"height"}}}}),this.rootMark=this.getMarkById("root")}parseGlobalSpec(t){t.background&&(this._background=t.background,this.renderer.background(this._background)),t.width&&this.width(t.width),t.height&&this.height(t.height),t.padding&&this.padding(t.padding)}parseMarkSpec(t){var e;const i=t.type===OV.glyph?{glyphType:t.glyphType}:t.type===OV.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(FG);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(jG);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(zG);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(HG);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(NG);if(arguments.length){const i=O$(t);return this.updateSignal(e,i),i}return O$(e.output())}autoFit(t){const e=this.getSignalById(WG);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(VG);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=HV.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===OV.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Y$;e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(NV.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(NV.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(NV.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{l$(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(NV.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(NV.BEFORE_MARK_RENDER_END),l$(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(NV.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}runSync(t){return this.evaluateSync(t),this}isRunning(){return this._running}runAsync(t){return aK(this,void 0,void 0,(function*(){for(;this._running;)yield this._running;const e=()=>{this._running=null};return(this._running=this.evaluate(t)).then(e,e),this._running}))}runNextTick(t){return aK(this,void 0,void 0,(function*(){return this._currentDataflow||(this._currentDataflow=Promise.resolve().then((()=>this.runAsync(t).then((()=>{this._currentDataflow=null})).catch((t=>{this._currentDataflow=null,this.logger.error(t)}))))),yield this._currentDataflow,this}))}doRender(t){this.emit(NV.BEFORE_DO_RENDER),this.renderer&&(this._progressiveMarks||this.animate.animate(),this.renderer.render(t),this.handleRenderEnd()),this.emit(NV.AFTER_DO_RENDER)}evaluate(t){var e,i;return aK(this,void 0,void 0,(function*(){const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),yield this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,yield this._dataflow.evaluate()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!1),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}))}evaluateSync(t){var e,i;const n=B$(t);this.reuseCachedGrammars(n);const s=this._cachedGrammars.size()>0;this.detachCachedGrammar();const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return s||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluateSync(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=HV.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=HV.reevaluate,this._dataflow.evaluateSync()),this._layoutState=HV.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),this.doRender(!0),null===(i=this._willMorphMarks)||void 0===i||i.forEach((t=>{this._morph.morph(t.prev,t.next,n)})),this._willMorphMarks=null,this.releaseCachedGrammars(n),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(this._willMorphMarks||(this._willMorphMarks=[]),t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._morph.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!R$.includes(t.id())))).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._morph.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._morph.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{const i=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));i&&t.reuse?(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0])):(t.morph&&n||t.morphAll)&&this._willMorphMarks.push({prev:e.prev,next:e.next})}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const n=t;null===(i=null===(e=n.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,n)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{e.mark.animate.stop(),t.enableExitAnimation&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&0===t.mark.animate.getAnimatorCount()&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;0===e.animate.getAnimatorCount()?i(t):e.addEventListener("animationEnd",(()=>{0===e.animate.getAnimatorCount()&&i(t)}))})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return l$(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,n,s,r;if(this.autoFit()){const a=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,n,s,r,a,o,l,h,c;const d=null===(s=null===(n=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===n?void 0:n.getContainer)||void 0===s?void 0:s.call(n);if(d){const{width:t,height:e}=hn(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return aK(this,void 0,void 0,(function*(){let n=!1;return t!==this.width()&&(n=!0,this.updateSignal(FG,t)),e!==this.height()&&(n=!0,this.updateSignal(jG,e)),n&&(i?yield this.evaluate():yield this._dataflow.evaluate()),this}))}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}bindEvents(t){if(this._eventConfig.disable)return;const{type:e,filter:i,callback:n,throttle:s,debounce:r,consume:a,target:o,dependency:h}=t,d=D$(e);if(!d)return;const{source:u,type:p}=d,f=l((_=d).markId)?t=>t&&t.mark.id()===_.markId:l(_.markName)?t=>t&&t.mark.name()===_.markName:l(_.type)?t=>t&&t.mark.markType===_.type:()=>!0,v=(Array.isArray(o)&&o.length?o.map((t=>({signal:this.getSignalById(t.target),callback:t.callback}))):[{signal:g(o)?this.getSignalById(o):null,callback:n}]).filter((t=>t.signal||t.callback)),m=SV(h,this),y=I$(((t,e)=>{const n=u===IG&&function(t,e){const i=t.defaults,n=i.prevent,s=i.allow;return!1!==n&&!0!==s&&(!0===n||!1===s||(n?n[e]:!!s&&!s[e]))}(this._eventConfig,p)||a&&(void 0===t.cancelable||t.cancelable);u===BG&&(t=GG(0,t,e,p,BG));let s=!1;if((!i||i(t))&&(!f||f(e))&&v.length){const e=m.reduce(((t,e)=>(t[e.id()]=e.output(),t)),{});v.forEach((i=>{i.callback&&i.signal?i.signal.set(i.callback(t,e))&&(this.commit(i.signal),s=!0):i.callback?i.callback(t,e):(this.commit(i.signal),s=!0)}))}n&&t.preventDefault(),a&&t.stopPropagation(),s&&this.runAsync()}),{throttle:s,debounce:r});var _;if(u===IG){if(function(t,e,i){const n=null==t?void 0:t[e];return!(!1===n||c(n)&&!n[i])}(this._eventConfig,IG,p))return this.addEventListener(p,y,DG),()=>{this.removeEventListener(p,y)}}else if(u===BG)return XH.addEventListener(p,y),this._eventListeners.push({type:p,source:XH,handler:y}),()=>{XH.removeEventListener(p,y);const t=this._eventListeners.findIndex((t=>t.type===p&&t.source===XH&&t.handler===y));t>=0&&this._eventListeners.splice(t,1)}}event(t){if("between"in t){const[e,i]=t.between,n=`${e.type}-${t.type}-${i.type}`;let s;this.bindEvents(Object.assign({},e,{callback:()=>{if(this._eventCache||(this._eventCache={}),!this._eventCache[n]){const e=this.bindEvents(t);this._eventCache[n]=e}s||(s=this.bindEvents(Object.assign({},i,{callback:()=>{this._eventCache[n]&&(this._eventCache[n](),this._eventCache[n]=null)}})))}}))}else"merge"in t?t.merge.forEach((e=>{const i=Object.assign({},t);g(e)?i.type=e:c(e)&&Object.assign(i,e),i.debounce=50,this.bindEvents(i)})):this.bindEvents(t)}hover(t){const e=t||"hover";return this.addEventListener("pointerover",(t=>{t.element&&t.element.addState(e)})),this.addEventListener("pointerout",(t=>{t.element&&t.element.removeState(e)})),this}cursor(){this._cursorValue={user:LG,element:null},this.addEventListener("mousemove",(t=>{var e,i,n;const s=null===(i=null===(e=null==t?void 0:t.element)||void 0===e?void 0:e.graphicItem)||void 0===i?void 0:i.cursor,r=this._cursorValue,a=r?g(r)?r:r.user:LG,o=r&&a===r.user&&(s===r.element||l(s)&&l(r.element))?r:{user:a,element:s};o!==r&&(this._cursorValue=o,this.setCursor(o.user&&o.user!==LG?o.user:null!==(n=o.element)&&void 0!==n?n:o.user))}))}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}addEventListener(t,e,i){let n=e;return i&&!1===i.trap||(n=e,n.raw=e),i&&i.target&&(n.target=i.target),this.on(t,n),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}setCursor(t){if(this._options.domBridge&&this._options.domBridge.setCursor)return void this._options.domBridge.setCursor(t);const e=this.globalCursor()?!l(document)&&document.body:this.container;return e?l(t)?e.style.removeProperty("cursor"):e.style.cursor=t:void 0}globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=this.setCursor(null);this._globalCursor=!!t,e&&this.setCursor(e)}return this}return this._globalCursor}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new h$(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initializeBuiltEvents(){this._options.cursor&&this.cursor(),this._options.hover&&this.hover(),this._bindResizeEvent()}initialize(){var t,e;this.grammars=new eK((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new iK((t=>t.id())),this._options.logger&&qe.setInstance(this._options.logger),this.logger=qe.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new o$,this.animate=new nK(this),this._morph=new tK,this._options.hooks&&(Object.keys(this._options.hooks).forEach((t=>{this.on(t,this._options.hooks[t])})),this.hooks=this._options.hooks),this.container=null,this.renderer=null,this._globalCursor=!1,this._eventListeners=[],this._eventConfig=function(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{f(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[IG,BG]),e}(this._options.eventConfig),this.globalCursor(this._eventConfig.globalCursor),this._background=this._options.background,this.parseBuiltIn(),(e=this._options).mode&&XH.setEnv(e.mode,e.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this.initializeBuiltEvents(),this._currentDataflow=null,this._needBuildLayoutTree=!0,this._layoutState=HV.before}normalBrowserEnv(){return"browser"===this._options.mode}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==OV.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=XH.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}}clearProgressive(){this._progressiveRafId&&XH.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i;this._unBindResizeEvent(),this.clearProgressive(),lV(),this.animate.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow=null,null===(e=null===(t=this.renderer)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this.renderer=null,this.removeAllListeners(),null===(i=this._eventListeners)||void 0===i||i.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const lK=function(){for(var t=arguments.length,e=new Array(t),i=0;i{Object.keys(t).forEach((e=>{oV(e,t[e],!0)}))}))};lK(TW);const hK=["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 cK,dK,uK;!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.rawDataStatisticsUpdate="rawDataStatisticsUpdate",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.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease"}(cK||(cK={})),function(t){t.chart="chart",t.window="window"}(dK||(dK={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(uK||(uK={}));const pK=`${IN}_waterfall_default_seriesField`,gK=`${IN}_DEFAULT_DATA_INDEX`,fK=`${IN}_DEFAULT_DATA_KEY`,vK=`${IN}_DEFAULT_DATA_SERIES_FIELD`,mK=`${IN}_DEFAULT_SERIES_STYLE_NAME`;var yK;!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.Built_In=99]="Built_In"}(yK||(yK={}));const _K=`${IN}_STACK_START`,bK=`${IN}_STACK_END`,xK=`${IN}_STACK_START_PERCENT`,SK=`${IN}_STACK_END_PERCENT`,wK=`${IN}_STACK_START_OffsetSilhouette`,AK=`${IN}_STACK_END_OffsetSilhouette`,kK=`${IN}_STACK_TOTAL`,MK=`${IN}_STACK_TOTAL_PERCENT`,CK=`${IN}_STACK_TOTAL_TOP`,TK=`${IN}_SEGMENT_START`,EK=`${IN}_SEGMENT_END`;var PK,RK;!function(t){t[t.Axis_Grid=100]="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"}(PK||(PK={})),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"}(RK||(RK={}));const OK=["linear","radial","conical"],BK={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}},IK=(t,e,i)=>{const n=t.getRegionsInIds(V(e.layoutBindRegionID));return null==n?void 0:n.some((t=>{const e=t.getLayoutRect(),n=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:n.x,y:n.y},{x:e.width+n.x,y:e.height+n.y})}))},DK=(t,e)=>{var i,n;return t===e||!l(t)&&!l(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(n=e.axis)||void 0===n?void 0:n.id))},LK=(t,e,i,n)=>{var s;const r=hl(e.getScale().type),a=[],o=e.getRegions();for(const e of o){const o=e.getSeries();for(const e of o)if(e.coordinate===i){const i=V(n(e)),o=null===(s=e.getViewData())||void 0===s?void 0:s.latestData;if(i&&o)if(r)a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())}))});else if(h(i[1]))a.push({series:e,datum:o.filter((e=>{var n;return(null===(n=e[i[0]])||void 0===n?void 0:n.toString())===(null==t?void 0:t.toString())||h(e[i[0]])&&h(e[i[1]])&&t>=e[i[0]]&&t{if(h(e[i[0]])){const a=Math.abs(e[i[0]]-t),o=Math.sign(e[i[0]]-t);a{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&("x"===e?"bottom"===n.getOrient()||"top"===n.getOrient():"left"===n.getOrient()||"right"===n.getOrient())&&IK(t,n,i)));return n.length?n:null},XK=t=>t.fieldX[0],$K=t=>t.fieldY[0],KK=t=>[t.fieldX[0],t.fieldX2],qK=t=>[t.fieldY[0],t.fieldY2],ZK=(t,e)=>{var i,n;if(!t)return null;const s=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.forEach((t=>{hl(t.getScale().type)?h.add(t):c.add(t)}))));const d=[],u=(t,e)=>{("x"===t?o:l).forEach((i=>{if((e?h:c).has(i)){const n=JK(i,"x"===t?r:a,t,"x"===t?e?XK:KK:e?$K:qK);n&&d.push(n)}}))};return t.getSpec().direction===HK.horizontal?(u("y",h.size>0),0===d.length&&u("x",h.size>0)):(u("x",h.size>0),0===d.length&&u("y",h.size>0)),d.length?d:null},JK=(t,e,i,n)=>{const s=t.getScale(),r=e-t.getLayoutStartPoint()[i];if((r-s.range()[0])*(r-s.range()[1])>0)return null;const a=s.invert(r);return QK(t,a,n)},QK=(t,e,i)=>{const n=t.getScale();if(l(e))return null;let s=n.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));s<0&&(s=void 0);const r=LK(e,t,"cartesian",null!=i?i:VK(t.getOrient())?XK:$K);return{index:s,value:e,axis:t,data:r}},tq=(t,e,i)=>{const n=t.getAllComponents().filter((n=>"axes"===n.specKey&&n.getOrient()===e&&IK(t,n,i)));return n.length?n:null},eq=(t,e)=>{if(!t)return null;const i=(t=>{const e=t.getRegionsInIndex();for(let t=0;tt.getDimensionField()[0];return r&&r.forEach((t=>{var e;const i=t.getScale(),r=null==i?void 0:i.domain(),c=null==i?void 0:i.range();if(i&&hl(i.type)){const d=t.getCenter(),u={x:n-t.getLayoutStartPoint().x-d.x,y:s-t.getLayoutStartPoint().y-d.y};let p=el({x:1,y:0},u);p=((t,e)=>{const i=2*Math.PI,n=Math.min(...e),s=Math.max(...e);return ts&&(t-=Math.ceil((t-s)/i)*i),t})(p,c);const g=il(u),f=null===(e=a[0])||void 0===e?void 0:e.getScale(),v=null==f?void 0:f.range();if((p-(null==c?void 0:c[0]))*(p-(null==c?void 0:c[1]))>0||(g-(null==v?void 0:v[0]))*(g-(null==v?void 0:v[1]))>0)return;const m=Math.abs(c[0]-c[1])/r.length/2,y=i.invert(p+m);if(l(y))return;let _=i.domain().findIndex((t=>(null==t?void 0:t.toString())===y.toString()));_<0&&(_=void 0);const b=LK(y,t,"polar",h);o.push({index:_,value:y,axis:t,data:b})}})),a&&a.forEach((t=>{var e;const i=t.getScale(),a=null==i?void 0:i.range();if(i&&hl(i.type)){const c=t.getCenter(),d={x:n-t.getLayoutStartPoint().x-c.x,y:s-t.getLayoutStartPoint().y-c.y};let u=el({x:1,y:0},d);u<-Math.PI/2&&(u=2*Math.PI+u);const p=il(d),g=null===(e=r[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==a?void 0:a[0]))*(p-(null==a?void 0:a[1]))>0)return;const v=i.invert(p);if(l(v))return;let m=i.domain().findIndex((t=>(null==t?void 0:t.toString())===v.toString()));m<0&&(m=void 0);const y=LK(v,t,"polar",h);o.push({index:m,value:v,axis:t,data:y})}})),o.length?o:null};class iq{constructor(t,e){var i,n;this._eventDispatcher=t,this._mode=e,this._chart=null===(n=(i=this._eventDispatcher.globalInstance).getChart)||void 0===n?void 0:n.call(i)}register(t,e){var i,n;(null!==(n=null===(i=this._chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==n?n:_o)("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:_o)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,n;const s=null!==(i=ZK(this._chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(n=eq(this._chart,{x:t,y:e}))&&void 0!==n?n:[],a=[].concat(s,r);return 0===a.length?null:a}dispatch(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>{if("axes"!==t.specKey)return!1;return!!hl(t.getScale().type)&&(!(null==e?void 0:e.filter)||e.filter(t))})),s=[];return n.forEach((e=>{const i=QK(e,t);i&&s.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:s}),s}}var nq;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nq||(nq={}));const sq={[nq.dimensionHover]:class extends iq{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);null===n&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:[...this._cacheDimensionInfo]})),this._cacheDimensionInfo=n):null===n||null!==this._cacheDimensionInfo&&n.length===this._cacheDimensionInfo.length&&!n.some(((t,e)=>!DK(t,this._cacheDimensionInfo[e])))?null!==n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:[...n]})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:[...n]})),this._cacheDimensionInfo=n)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?[...this._cacheDimensionInfo]:[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseOut}),Ao(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Ao(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[nq.dimensionClick]:class extends iq{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,n=this.getTargetDimensionInfo(e,i);n&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:[...n]}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:dK.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let rq=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const n="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(sq[t]){const e=new sq[t](this._eventDispatcher,this._mode);e.register(t,n),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,n);return this}off(t,e,i){var n,s;const r=null!=i?i:e;if(sq[t])if(r)null===(n=this._composedEventMap.get(r))||void 0===n||n.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(s=this._composedEventMap.get(e[0]))||void 0===s||s.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}release(){this._eventDispatcher.release(),this._composedEventMap.clear()}};class aq{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(uK.vchart,[]),this._levelNodes.set(uK.chart,[]),this._levelNodes.set(uK.model,[]),this._levelNodes.set(uK.mark,[])}addHandler(t,e){var i;const n={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(n),this._map.set(t.callback,n),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),n=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==n&&n>=0&&(null==i||i.splice(n,1)),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const oq={cartesianAxis:"axis","cartesianAxis-band":"axis","cartesianAxis-linear":"axis","cartesianAxis-time":"axis",polarAxis:"axis","polarAxis-band":"axis","polarAxis-linear":"axis",discreteLegend:"legend",continuousLegend:"legend",colorLegend:"legend",sizeLegend:"legend",label:"label"};class lq{constructor(t,e){this._viewBubbles=new Map,this._windowBubbles=new Map,this._viewListeners=new Map,this._windowListeners=new Map,this.globalInstance=t,this._compiler=e}register(t,e){var i,n,s,r;this._parseQuery(e);const a=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||dK.chart),o=this.getEventListeners((null===(n=e.filter)||void 0===n?void 0:n.source)||dK.chart);a.get(t)||a.set(t,new aq);if(a.get(t).addHandler(e,null===(s=e.filter)||void 0===s?void 0:s.level),this._isValidEvent(t)&&!o.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),o.set(t,i)}return this}unregister(t,e){var i,n,s,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||dK.chart),l=this.getEventListeners((null===(n=null==e?void 0:e.filter)||void 0===n?void 0:n.source)||dK.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===(s=null==e?void 0:e.wrappedCallback)||void 0===s?void 0:s.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)||dK.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const n=this.getEventBubble(e.source||dK.chart).get(t);if(!n)return this;let s=!1;if(i){const r=n.getHandlers(i);s=this._invoke(r,t,e)}else{const i=n.getHandlers(uK.mark);if(s=this._invoke(i,t,e),!s){const i=n.getHandlers(uK.model);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.chart);s=this._invoke(i,t,e)}if(!s){const i=n.getHandlers(uK.vchart);s=this._invoke(i,t,e)}}return this}release(){for(const t of this._viewListeners.entries())this._compiler.removeEventListener(dK.chart,t[0],t[1]);this._viewListeners.clear();for(const t of this._windowListeners.entries())this._compiler.removeEventListener(dK.window,t[0],t[1]);this._windowListeners.clear();for(const t of this._viewBubbles.values())t.release();this._viewBubbles.clear();for(const t of this._windowBubbles.values())t.release();this._windowBubbles.clear()}_filter(t,e,i){var n,s,r;if(o(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&T(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(n=null==i?void 0:i.mark)||void 0===n?void 0:n.name)!==t.markName)return!1;let a=null===(s=i.model)||void 0===s?void 0:s.type;return oq[a]&&(a=oq[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))&&(!h(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),n=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:n})}return Object.assign({},e)}_onDelegate(t){var e;const i=this.globalInstance.getChart(),n=h(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,s=h(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&h(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();h(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:n,mark:null!=s?s:void 0,node:T(t.event,"target")};this.dispatch(t.type,o)}_invoke(t,e,i){const n=t.map((t=>{var n,s,r;const a=t.filter;if(!t.query||this._filter(a,e,i)){let e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i));return(null===(n=t.query)||void 0===n?void 0:n.consume)&&(e=!0,null===(s=i.event)||void 0===s||s.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),e}}));return n.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:h(t.id)?uK.model:uK.vchart:uK.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=mt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=vt(t.callback,i.debounce));let n=this._getQueryLevel(i),s=null,r=dK.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)||n!==uK.model&&n!==uK.mark||(s=i.type),(null==i?void 0:i.source)&&(r=i.source),h(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,n=uK.model),t.filter={level:n,markName:o,type:s,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 dK.chart:return this._viewBubbles;case dK.window:return this._windowBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case dK.chart:return this._viewListeners;case dK.window:return this._windowListeners;default:return this._viewListeners}}_isValidEvent(t){return hK.includes(t)||Object.values(NV).includes(t)||Object.values(cK).includes(t)}}function hq(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function cq(t,e,i){t.getParser(e)||t.registerParser(e,i)}const dq=new Map;let uq;function pq(t,e,i={type:"geojson",centroid:!0}){dq.has(t)&&yo(`map type of '${t}' already exists, will be overwritten.`),uq||(uq=new uo,cq(uq,"geojson",ro),cq(uq,"topojson",oo),hq(uq,"simplify",Ea));const n=new go(uq),s=D({},{centroid:!0,simplify:!1},i);"topojson"===i.type?n.parse(e,{type:"topojson",options:s}):n.parse(e,{type:"geojson",options:s}),!0===i.simplify&&n.transform({type:"simplify"}),dq.set(t,n)}function gq(t,e=!1){let i=e;return t.latestData instanceof go&&(i=!1),i?R(t.latestData):t.latestData.slice()}const fq=(t,e)=>0===t.length?[]:1===t.length?gq(t[0],null==e?void 0:e.deep):t.map((t=>gq(t,null==e?void 0:e.deep)));function vq(t,e,i){hq(e=e instanceof uo?e:t.dataSet,"copyDataView",fq);const n=new go(e,i);return n.parse([t],{type:"dataview"}),n.transform({type:"copyDataView"}),n}function mq(t,e,i=[],n={}){var s,r,a,o;if(t instanceof go)return t;const{id:l,values:h=[],fromDataIndex:c,fromDataId:d,transforms:u=[],fields:p}=t,f=null!==(s=t.parser)&&void 0!==s?s:{clone:!0};let v;f.clone=!(!1===f.clone);const m=i.find((t=>t.name===l));if(m)v=m;else{const t={name:l};if(p&&(t.fields=p),v=new go(e,t),"string"==typeof d){const t=i.find((t=>t.name===d));if(!t)return(null!==(r=n.onError)&&void 0!==r?r:_o)(`no data matches fromDataId ${d}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else if("number"==typeof c){const t=i[c];if(!t)return(null!==(a=n.onError)&&void 0!==a?a:_o)(`no data matches fromDataIndex ${c}`),null;v.parse([t],{type:"dataview"}),v.transform({type:"copyDataView"})}else Array.isArray(h)?v.parse(h,f):!g(h)||f&&!["csv","dsv","tsv"].includes(f.type)?(v.parse([]),yo("values should be array")):v.parse(h,null!==(o=f)&&void 0!==o?o:{type:"csv"});u&&u.length&&u.forEach((t=>{e.getTransform(t.type)&&v.transform(t)}))}return v}const yq=(t,e)=>{const i={nodes:{}},{fields:n}=e;if(!(null==n?void 0:n.length))return i;const s=n.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData.forEach((t=>{o=i;for(let e=0;e({visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"labelReverseFontColor"},fontSize:mN,fontFamily:hN},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"primaryFontColor"},outerBorder:{stroke:{type:"palette",key:"primaryFontColor"},distance:0,lineWidth:3},cornerRadius:1}}}),jq={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineDash:[]}},label:Fq()},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"secondaryFontColor"},opacity:.7,lineDash:[2,3]}},label:Fq()}},zq={padding:[12,0],showDetail:"auto",brushSelect:!1,middleHandler:{visible:!1,background:{size:6,style:{stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},cornerRadius:2}},icon:{style:{size:4,fill:{type:"palette",key:"dataZoomHandlerFillColor"},stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},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:"dataZoomBackgroundColor"},lineWidth:0}},selectedBackground:{style:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.1,outerBorder:{stroke:{type:"palette",key:"dataZoomSelectedColor"},strokeOpacity:.2,distance:-.5,lineWidth:1}}},selectedBackgroundChart:{area:{style:{visible:!1,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:!1,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}},startHandler:{style:{symbolType:"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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},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\n C-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\n C0.3-1.4,0.3-1.4,0.3-1.4z",fill:{type:"palette",key:"dataZoomHandlerFillColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandlerStrokeColor"},lineWidth:1,zIndex:100}},startText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:{area:{style:{stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}},Hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:{fontSize:dN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}},content:{visible:!0,style:{fontSize:uN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}}},Nq={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},space:12},handler:{visible:!0},startText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:mN,lineHeight:yN,fontFamily:hN,fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},Vq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.3}}},Wq={horizontal:Object.assign(Object.assign({},Nq),{rail:{width:200,height:8,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq}),vertical:Object.assign(Object.assign({},Nq),{rail:{width:8,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Vq})},Gq={orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:mN,lineHeight:yN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"normal"},space:12},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"axisGridColor"}},unSelectedHover:{fill:{type:"palette",key:"axisGridColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1},state:{unSelected:{fillOpacity:.5}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:mN,lineHeight:yN,fontFamily:hN},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"}}}}},allowAllCanceled:!1},Uq={style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"dataZoomSelectedColor"}},fill:{type:"palette",key:"dataZoomHandlerFillColor"}}},Yq={horizontal:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:200,height:4,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq}),vertical:Object.assign(Object.assign({},Nq),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"dataZoomSelectedColor",a:.8}}},rail:{width:4,height:200,style:{fill:{type:"palette",key:"dataZoomBackgroundColor"}}},handler:Uq})},Xq={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:hN,colorScheme:xq,mark:Iq,markByName:Dq,series:Bq,component:{discreteLegend:Gq,colorLegend:Wq,sizeLegend:Yq,axis:Lq,axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:{label:{space:8},title:{space:8},maxHeight:"30%"},axisY:{label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%"},axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:8}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:{line:{style:{lineDash:[3,3],stroke:"rgba(46, 47, 50)"}},startSymbol:{visible:!1,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},endSymbol:{visible:!0,symbolType:"triangle",style:{stroke:null,lineWidth:0,fill:"rgba(46, 47, 50)",size:10}},label:{refY:5,style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"rgb(48, 115, 242)"}}}},markArea:{area:{style:{fill:"rgba(46, 47, 50, 0.1)"}},label:{style:{fontSize:fN,fontFamily:hN,fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"labelReverseFontColor"},stroke:{type:"palette",key:"labelReverseFontColor"},lineWidth:0},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:0,fill:"#F68484"}}}},markPoint:{itemLine:{decorativeLine:{visible:!1},startSymbol:{size:5,visible:!0,style:{fill:"#eee"}},line:{style:{stroke:"#eee"}}},itemContent:{offsetY:-50}},tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"tooltipBackgroundColor"},border:{color:{type:"palette",key:"tooltipBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor",a:.1}}},spaceRow:6,titleLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},fontWeight:"bold",textAlign:"left",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:"secondaryFontColor"},textAlign:"left",textBaseline:"middle",spacing:26},valueLabel:{fontSize:fN,lineHeight:vN,fontFamily:hN,fontColor:{type:"palette",key:["titleFontColor","primaryFontColor"]},textBaseline:"middle",spacing:0}},dataZoom:zq,crosshair:jq,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"dataZoomBackgroundColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"dataZoomSelectedColor"}}},controller:{start:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},pause:{order:0,space:0,style:{size:25,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"end",style:{size:12,fill:{type:"palette",key:"dataZoomSelectedColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:Hq,title:{padding:{top:4,bottom:20},textStyle:{fontSize:pN,lineHeight:gN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},subtextStyle:{fontSize:fN,lineHeight:vN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}}},mapLabel:{visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:_N,fontFamily:hN}},background:{visible:!0,padding:{top:4,bottom:4,left:6,right:6},style:{cornerRadius:2,lineWidth:1,fill:"white",stroke:"grey"}},leader:{visible:!1,style:{lineWidth:1,stroke:"red"}}},poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:mN,fontFamily:hN,fontWeight:"bold",fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}},contentStyle:{fontSize:mN,fontFamily:hN,fill:{type:"palette",key:"secondaryFontColor"}},panel:{visible:!0,fill:{type:"palette",key:"tooltipBackgroundColor"},cornerRadius:3,lineWidth:0,shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor",a:.1},size:0,space:12}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:fN,fontFamily:hN,fill:{type:"palette",key:["titleFontColor","primaryFontColor"]}}}},animationThreshold:2e3},$q={orient:"right",position:"middle",padding:30,title:{visible:!1,padding:0,textStyle:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"titleFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},endText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}},handlerText:{style:{fontSize:cN,fontWeight:"normal",fill:{type:"palette",key:"labelFontColor"}}}},Kq={style:{symbolType:"circle",lineWidth:4,outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"},size:10,stroke:"#fff"}};Object.assign(Object.assign({},$q),{rail:{width:200,height:8,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq}),Object.assign(Object.assign({},$q),{rail:{width:8,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:Kq});const qq=t=>({style:{symbolType:cX(t),fill:"#fff",lineWidth:1,size:10,stroke:"#ccc",outerBorder:!1}});Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:200,height:4,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("top")}),Object.assign(Object.assign({},$q),{sizeBackground:{fill:"#cdcdcd"},track:{style:{fill:"rgba(20,20,20,0.1)"}},rail:{width:4,height:200,style:{fill:"rgba(0,0,0,0.04)"}},handler:qq("right")});const Zq={name:"dark",colorScheme:{default:{dataScheme:bq,palette:{backgroundColor:"#202226",borderColor:"#404349",shadowColor:"#000000",primaryFontColor:"#fdfdfd",secondaryFontColor:"#888c93",axisFontColor:"#bbbdc3",disableFontColor:"#55595f",labelReverseFontColor:"#202226",axisGridColor:"#404349",axisDomainColor:"#4b4f54",axisLabelFontColor:"#bbbdc3",dataZoomHandlerStrokeColor:"#888c93",dataZoomHandlerFillColor:"#202226",dataZoomBackgroundColor:"#404349",dataZoomChartColor:"#55595F",dataZoomSelectedColor:"#4284FF",tooltipBackgroundColor:"#404349",titleFontColor:"#fdfdfd",labelFontColor:"#bbbdc3"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},Jq=new Map([[Xq.name,Xq],[Zq.name,Zq]]),Qq=Xq.name,tZ=new Map([[Qq,Jq.get(Qq)]]),eZ=t=>yc({},Jq.get(Qq),t);Jq.forEach(((t,e)=>{e!==Qq&&tZ.set(e,eZ(t))}));class iZ{static registerInstance(t){iZ.instances.set(t.id,t)}static unregisterInstance(t){iZ.instances.delete(t.id)}static getInstance(t){return iZ.instances.get(t)}static instanceExist(t){return iZ.instances.has(t)}static forEach(t,e=[],i){const n=V(e);return iZ.instances.forEach(((e,i,s)=>{n.includes(i)||t(e,i,s)}),i)}}iZ.instances=new Map;class nZ{static registerTheme(t,e){t&&nZ.themes.set(t,eZ(e))}static getTheme(t){return nZ.themes.get(t)||nZ.getDefaultTheme()}static removeTheme(t){return nZ.themes.delete(t)}static themeExist(t){return nZ.themes.has(t)}static getDefaultTheme(){return nZ.themes.get(Qq)}static setCurrentTheme(t){nZ.themeExist(t)&&(nZ._currentThemeName=t,iZ.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(){return nZ.getTheme(nZ._currentThemeName)}static getCurrentThemeName(){return nZ._currentThemeName}}var sZ,rZ,aZ,oZ;function lZ(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"}return"browser"}nZ.themes=tZ,nZ._currentThemeName=Qq,function(t){t.data="data",t.signal="signal",t.mark="mark"}(sZ||(sZ={})),lK(TW);class hZ{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this.isInited=!1,this.isReleased=!1,this._model={[sZ.signal]:{},[sZ.data]:{},[sZ.mark]:{}},this._compileChart=null,this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i;if(this.isReleased)return;if(this.isInited=!0,this._view)return;const n=new qe(null!==(t=this._option.logLevel)&&void 0!==t?t:Ke.Error);this._option.onError&&n.addErrorHandler(((...t)=>{this._option.onError(...t)})),this._view=new oK(Object.assign(Object.assign({width:this._width,height:this._height,hover:!1,select:!1,container:null!==(e=this._container.dom)&&void 0!==e?e:null,renderCanvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,hooks:this._option.performanceHook,cursor:!1},this._option),{mode:lZ(this._option.mode),autoFit:!1,eventConfig:{gesture:Ao(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle();!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!g(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){const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend())}clear(t){const{chart:e}=t;e.clear(),this.releaseGrammar()}renderAsync(t){var e;return mn(this,void 0,void 0,(function*(){return this.initView(),this._view?(yield null===(e=this._view)||void 0===e?void 0:e.runNextTick(t),this):Promise.reject("srView init fail")}))}renderSync(t){var e;this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.runSync(t))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e){return this._view?(this._width=t,this._height=e,this._view.resize(t,e),this.reRenderAsync({morph:!1})):Promise.reject()}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}reRenderAsync(t){return this.isInited&&(this._rafId&&XH.getCancelAnimationFrame()(this._rafId),this._rafId=XH.getRequestAnimationFrame()((()=>{this.renderSync(t)}))),Promise.resolve()}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var n;if(!1!==this._option.interactive)if(t===dK.chart){const s=function(n,s){var r,a,o;const l=null!==(a=null===(r=null==s?void 0:s.mark)||void 0===r?void 0:r.context)&&void 0!==a?a:{},c=h(l.modelId)?l.modelId:null,d=h(l.markId)?l.markId:null,u=h(l.modelUserId)?l.modelUserId:null,p=h(l.markUserId)?l.markUserId:null,g={event:n,type:e,source:t,item:s,datum:(null===(o=null==s?void 0:s.getDatum)||void 0===o?void 0:o.call(s))||null,markId:d,modelId:c,markUserId:p,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:s}),null===(n=this._view)||void 0===n||n.addEventListener(e,s)}else if(t===dK.window){const n=function(n){const s={event:n,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,s)}.bind(this);this._windowListeners.set(i,{type:e,callback:n});const s=this._getGlobalThis();null==s||s.addEventListener(e,n)}}removeEventListener(t,e,i){var n,s,r;if(!1!==this._option.interactive)if(t===dK.chart){const t=null===(n=this._viewListeners.get(i))||void 0===n?void 0:n.callback;t&&(null===(s=this._view)||void 0===s||s.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===dK.window){const t=this._getGlobalThis(),n=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;n&&(null==t||t.removeEventListener(e,n)),this._windowListeners.delete(i)}}releaseEvent(){this._viewListeners.clear(),this._windowListeners.clear()}release(){var t;this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._rafId=null,this.isReleased=!0}releaseGrammar(){var t;this._releaseModel(),null===(t=this._view)||void 0===t||t.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(l(e))return;const i=e.id(),n=t.grammarType;l(this._model[n][i])&&(this._model[n][i]={}),this._model[n][i][t.id]=t}removeGrammarItem(t,e){var i;const n=t.getProduct();if(l(n))return;const s=n.id(),r=t.grammarType,a=this._model[r][s];h(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][s]),e||null===(i=this._view)||void 0===i||i.removeGrammar(n)}updateDepend(t){return h(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),n=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(n)}))})),!0)}_getGlobalThis(){var t;return wo(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function cZ(t,e){var i;return mn(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!==(i=null==e?void 0:e.onError)&&void 0!==i?i:_o)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function dZ(t){t.crosshair=V(t.crosshair||{}).map((e=>Lh({[t.direction===HK.horizontal?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function uZ(t,e){var i;const{width:n,height:s}=t;if(h(n)&&h(s))return{width:n,height:s};let r=DN,a=LN;const o=e.container,l=e.canvas;if(o){const{width:t,height:e}=hn(o,DN,LN);r=t,a=e}else if(l&&wo(e.mode)){let t;t=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l;const{width:e,height:i}=hn(t,DN,LN);r=e,a=i}else if(ko(e.mode)&&(null===(i=e.modeParams)||void 0===i?void 0:i.domref)){const t=e.modeParams.domref;r=t.width,a=t.height}return r=null!=n?n:r,a=null!=s?s:a,{width:r,height:a}}class pZ{static useChart(t){t.forEach((t=>BN.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>BN.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>BN.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return BN.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>BN.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){BN.registerTransform(t,e)}static registerMap(t,e,i){pq(t,e,i)}static unregisterMap(t){!function(t){dq.has(t)?dq.delete(t):yo(`map type of '${t}' does not exists.`)}(t)}static getMap(t){return e=t,dq.get(e);var e}static hideTooltip(t=[]){iZ.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 qe.getInstance()}getDataSet(){return this._dataSet}constructor(e,i){var n,s,r,a;this.id=Co(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],animation:!0,onError:t=>{throw new Error(t)}},this._observer=null,this._context={},this._onResize=vt(((...t)=>{var e,i;const{width:n,height:s}=hn(this._container,DN,LN),r=null!==(e=this._spec.width)&&void 0!==e?e:n,a=null!==(i=this._spec.height)&&void 0!==i?i:s;this._curSize.width===r&&this._curSize.height===a||(this.resize(r,a),this._curSize={width:r,height:a})}),100),this._option=D(this._option,i),this._onError=this._option.onError;const o=this._option,{dom:l,renderCanvas:h,mode:c,stage:d,poptip:u}=o,p=vn(o,["dom","renderCanvas","mode","stage","poptip"]);l&&(this._container=g(l)?null===document||void 0===document?void 0:document.getElementById(l):l),h&&(this._canvas=h),d&&(this._stage=d),"node"===c||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=nZ.getCurrentThemeName(),this._setSpec(e),this._updateCurrentTheme(),this._curSize=uZ(this._spec,{container:this._container,canvas:this._canvas,mode:this._option.mode||t.RenderModeEnum["desktop-browser"],modeParams:this._option.modeParams}),this._compiler=new hZ({dom:null!==(n=this._container)&&void 0!==n?n:"none",canvas:h},Object.assign(Object.assign({mode:this._option.mode,stage:d,pluginList:!1!==u?["poptipForText"]:[]},p),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._curSize.width,this._curSize.height),this._eventDispatcher=new lq(this,this._compiler),this._event=new rq(this._eventDispatcher,c),this._compiler.initView(),null===(s=this.getStage())||void 0===s||s.setTheme({text:{fontFamily:this._currentTheme.fontFamily}}),this._initDataSet(this._option.dataSet),this._autoSize=!!wo(c)&&(null===(a=null!==(r=e.autoFit)&&void 0!==r?r:this._option.autoFit)||void 0===a||a),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._event.emit(cK.initialized,{}),iZ.registerInstance(this)):this._option.onError("please specify container or renderCanvas!")}_setSpec(t){t&&(this._spec=xc(g(t)?JSON.parse(t):t))}_initData(){if(l(this._dataSet))return void yo("dataSet is not initialized");const t=V(this._spec.data),e=[];for(let i=0;ithis._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>this._currentTheme,layout:this._option.layout,onError:this._onError});i?(this._chart=i,this._chart.setCanvasRect(this._curSize.width,this._curSize.height),this._chart.created(),this._chart.init({})):this._option.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&!this._compiler.isReleased&&(this._compiler.getVGrammarView().addEventListener(NV.ALL_ANIMATION_END,(()=>{this._event.emit(cK.animationFinished,{})})),this._compiler.getVGrammarView().addEventListener(NV.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(cK.renderFinished,{})})))}_bindResizeEvent(){var t;if(this._autoSize){if(this._container){const e=window.ResizeObserver;this._observer=new e(this._onResize),null===(t=this._observer)||void 0===t||t.observe(this._container)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this._autoSize&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_initDataSet(t){this._dataSet=t instanceof uo?t:new uo,cq(this._dataSet,"dataview",lo),cq(this._dataSet,"array",yn),hq(this._dataSet,"stackSplit",yq),hq(this._dataSet,"copyDataView",fq);for(const t in BN.transforms)hq(this._dataSet,t,BN.transforms[t]);for(const t in BN.dataParser)cq(this._dataSet,t,BN.dataParser[t])}updateCustomConfigAndRerender(t,e){return mn(this,void 0,void 0,(function*(){const i=t();return h(i)?(this._reCompile(i),yield this.renderAsync(e),this):this}))}updateCustomConfigAndRerenderSync(t,e){const i=t();return h(i)?(this._reCompile(i),this.renderSync(e),this):this}_reCompile(t){var e,i,n;t.reMake?(this._releaseData(),this._initDataSet(),this._chart.release(),this._chart=null,null===(e=this._compiler)||void 0===e||e.releaseGrammar(),this._userEvents.forEach((t=>this.on(t.eType,t.query,t.callback)))):t.reCompile&&(null===(i=this._compiler)||void 0===i||i.clear({chart:this._chart,vChart:this}),null===(n=this._compiler)||void 0===n||n.compile({chart:this._chart,vChart:this},{}))}renderSync(t){var e,i,n,s,r,a,o,l,h,c,d;if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return null===(h=this._compiler)||void 0===h||h.renderSync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}renderAsync(t){var e,i,n,s,r,a,o,l,h,c,d;return mn(this,void 0,void 0,(function*(){if(!this._chart){if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e),this._initChart(this._spec),null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterInitializeChart)||void 0===s||s.call(n),!this._chart||!this._compiler)return this;null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o)}return yield null===(h=this._compiler)||void 0===h?void 0:h.renderAsync(t),this._option.animation&&(null===(c=this._chart)||void 0===c||c.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)})),null===(d=this._chart)||void 0===d||d.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(_q.update,!0)}))),this._event.emit(cK.rendered,{}),this}))}release(){var t,e,i,n;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),null===(e=this._chart)||void 0===e||e.release(),null===(i=this._compiler)||void 0===i||i.release(),null===(n=this._eventDispatcher)||void 0===n||n.release(),this._userEvents.length=0,this._unBindResizeEvent(),this._releaseData(),this._chart=null,this._compiler=null,this._spec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,iZ.unregisterInstance(this)}updateData(t,e,i){return mn(this,void 0,void 0,(function*(){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),yield this._compiler.renderAsync(),this;this._spec.data=V(this._spec.data);const n=this._spec.data.find((e=>e.name===t||e.id===t));return n?n.id===t?n.values=e:n.name===t&&n.parse(e,i):f(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e),this}))}updateDataInBatches(t){return mn(this,void 0,void 0,(function*(){return this._chart?(t.forEach((({id:t,data:e,options:i})=>{this._chart.updateData(t,e,!1,i)})),this._chart.updateGlobalScaleDomain(),yield this._compiler.renderAsync(),this):(t.forEach((({id:t,data:e,options:i})=>{const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}})),this)}))}updateDataSync(t,e,i){if(l(this._dataSet))return this;if(this._chart)return this._chart.updateData(t,e,!0,i),this._compiler.renderSync(),this;const n=this._spec.data.find((e=>e.name===t));if(n)n.parse(e,i);else{const n=new go(this._dataSet,{name:t});n.parse(e,i),this._spec.data.push(n)}return this}updateFullDataSync(t,e=!0){if(this._chart)return this._chart.updateFullData(t),e&&this._compiler.renderSync(),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return mn(this,void 0,void 0,(function*(){if(this._chart)return this._chart.updateFullData(t),e&&(yield this._compiler.renderAsync()),this;return V(t).forEach((t=>{const{id:e,values:i,parser:n,fields:s}=t,r=this._spec.data.find((t=>t.name===e));if(r)r.setFields(s),r.parse(i,n);else{const e=mq(t,this._dataSet,this._spec.data,{onError:this._option.onError});this._spec.data.push(e)}})),this}))}updateSpec(t,e=!1,i){return mn(this,void 0,void 0,(function*(){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),yield this.updateCustomConfigAndRerender((()=>{var e,n;return t=xc(t),this._spec=t,this._updateCurrentTheme(),null===(n=null===(e=this._compiler)||void 0===e?void 0:e.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}))}updateSpecSync(t,e=!1,i){return t?(g(t)&&(t=JSON.parse(t)),e&&(t=Lh({},this._spec,t)),this.updateCustomConfigAndRerenderSync((()=>{var e,n,s;return(t=xc(t)).data=null!==(e=t.data)&&void 0!==e?e:[],this._spec=t,this._updateCurrentTheme(),null===(s=null===(n=this._compiler)||void 0===n?void 0:n.getVGrammarView())||void 0===s||s.updateLayoutTag(),this._chart.updateSpec(t,i)}),i),this):this}resize(t,e){var i,n,s,r,a,o;return mn(this,void 0,void 0,(function*(){if(!this._chart||!this._compiler)return this;const l=this._chart.getCanvasRect();return l&&l.width===t&&l.height===e||(null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===n||n.call(i),this._chart.onResize(t,e),null===(r=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterResizeWithUpdate)||void 0===r||r.call(s),yield null===(o=(a=this._compiler).resize)||void 0===o?void 0:o.call(a,t,e)),this}))}updateViewBox(t,e=!0,i=!0){var n;return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.renderSync(),null===(n=this._chart)||void 0===n||n.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var n;this._userEvents.push({eType:t,query:e,callback:i}),null===(n=this._event)||void 0===n||n.on(t,e,i)}off(t,e){var i;const n=this._userEvents.findIndex((i=>i.eType===t&&i.callback===e));n>=0&&this._userEvents.splice(n,1),null===(i=this._event)||void 0===i||i.off(t,e)}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)}_updateCurrentTheme(){var t,e,i,n;const s=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.theme)&&void 0!==e?e:this._option.theme;if(g(s)){const t=yc({},nZ.getTheme(s));this._currentTheme=bc("theme",t,t.colorScheme),this._currentThemeName=s}else{const t=yc({},nZ.getTheme(this._currentThemeName),null!=s?s:{});this._currentTheme=bc("theme",t,t.colorScheme)}var r;r=bc("mark-theme",Lh({},null===(i=this._currentTheme.component)||void 0===i?void 0:i.poptip)),D(xU.poptip,bU,r),null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())}_getBackground(){return("string"==typeof this._spec.background?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return this._currentTheme}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return mn(this,void 0,void 0,(function*(){return nZ.themeExist(t)?(yield this.updateCustomConfigAndRerender((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}))}setCurrentThemeSync(t){return nZ.themeExist(t)?(this.updateCustomConfigAndRerenderSync((()=>{var e;return this._currentThemeName=t,this._updateCurrentTheme(),null===(e=this._chart)||void 0===e||e.setCurrentTheme(this._currentTheme,!0),{change:!0,reMake:!1}})),this):this}_getTooltipComponent(){var t;const e=null===(t=this._chart)||void 0===t?void 0:t.getAllComponents().find((t=>t.type===bn.tooltip));return e}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const n=this._getTooltipComponent();n&&(null===(i=null===(e=n.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),n.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 n=this._getTooltipComponent();return null!==(i=h(t)&&"none"!==(null==n?void 0:n.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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return 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.getAllComponents().filter((t=>t.type===bn.discreteLegend));return i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);n&&n.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const n=null===(i=this._chart)||void 0===i?void 0:i.getAllComponents().filter((t=>t.type===bn.discreteLegend));n[t]&&n[t].setSelectedData(e)}getDataURL(){return mn(this,void 0,void 0,(function*(){const t=this.getStage();if(this._chart&&t){t.render();const e=this._chart.getCanvas();return yield cZ(e,{onError:this._onError})}return this._option.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){return mn(this,void 0,void 0,(function*(){if(!wo(this._option.mode))return void this._option.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):this._option.onError(new ReferenceError("render is not defined"))}))}getImageBuffer(){if("node"!==this._option.mode)return void this._option.onError(new TypeError("getImageBuffer() now only support node environment."));const t=this.getStage();if(t){t.render();return t.window.getImageBuffer()}return this._option.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(h(this._container))return this._container;let e;return e=g(this._canvas)?null===document||void 0===document?void 0:document.getElementById(this._canvas):this._canvas,h(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1){var n;if(!this._chart)return null;if(C(t))return null;const{seriesId:s,seriesIndex:r=0}=e;let a;if(h(s)?a=this._chart.getSeriesInUserId(s):h(r)&&(a=null===(n=this._chart.getSeriesInIndex([r]))||void 0===n?void 0:n[0]),a){const e=Object.keys(t),n=a.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),s=a.getLayoutStartPoint();let r;return r=n?a.dataToPosition(n):a.dataToPosition(t),Th(r,s,i)}return null}convertValueToPosition(t,e,i=!1){var n,s;if(!this._chart||l(t)||C(e))return null;if(!f(t)){const{axisId:s,axisIndex:r}=e;let a;if(h(s)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===s)):h(r)&&(a=null===(n=this._chart.getComponentsByKey("axes"))||void 0===n?void 0:n[r]),!a)return yo("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 h(r)?o=this._chart.getSeriesInUserId(r):h(a)&&(o=null===(s=this._chart.getSeriesInIndex([a]))||void 0===s?void 0:s[0]),o?Th(o.valueToPosition(t[0],t[1]),o.getLayoutStartPoint(),i):(yo("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}}pZ.InstanceManager=iZ,pZ.ThemeManager=nZ,pZ.globalConfig={uniqueTooltip:!0},function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse"}(rZ||(rZ={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(aZ||(aZ={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.DIMENSION_SELECTED=1]="DIMENSION_SELECTED",t[t.RELATIONAL_SELECTED=2]="RELATIONAL_SELECTED",t[t.SELECTED=3]="SELECTED",t[t.DIMENSION_HOVER=4]="DIMENSION_HOVER",t[t.RELATIONAL_HOVER=5]="RELATIONAL_HOVER",t[t.HOVER=6]="HOVER"}(oZ||(oZ={}));class gZ{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){l(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,D({},gZ.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]}getMarksInType(t){const e=V(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]))))}}gZ.defaultMarkInfo={};class fZ{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new gZ,this._markReverse=new gZ,this._lastDimensionEvent=null,this.onHover=t=>{const e=this.getEventElement(t);switch(t.action){case"enter":this.interaction.getEventElement(rZ.STATE_DIMENSION_HOVER).forEach((t=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER_REVERSE,t)})),this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!1),e.forEach((({el:t,mark:e})=>{this.interaction.addEventElement(rZ.STATE_DIMENSION_HOVER,t)})),this.interaction.reverseEventElement(rZ.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(rZ.STATE_DIMENSION_HOVER,!0),t=null}this._lastDimensionEvent=t},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){C(t.stateStyle[rZ.STATE_DIMENSION_HOVER])||this._marks.addMark(t),C(t.stateStyle[rZ.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(nq.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));n.forEach((n=>{const s=n.getProduct().elements.filter((i=>{const n=i.getDatum();let s;return s=f(n)?n.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===n)),e?!s:s})).map((t=>({el:t,mark:n})));i.push(...s)}))}))})),i}dimensionDataEqual(t){if(this._lastDimensionEvent===t)return!0;if(!this._lastDimensionEvent||!t)return!1;if(this._lastDimensionEvent.dimensionInfo.length!==t.dimensionInfo.length)return!1;for(let e=0;ethis._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=RK.Region,this.layoutZIndex=0}getSpec(){return this._spec}getAutoIndent(){return this._autoIndent}getLayoutStartPoint(){return this._layoutStartPoint}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}_setLayoutAttributeFromSpec(t,e){if(!1!==this._spec.visible){const i=Mh(Ch(t.padding),e,e);this.layoutPaddingLeft=i.left,this.layoutPaddingRight=i.right,this.layoutPaddingTop=i.top,this.layoutPaddingBottom=i.bottom,this._minHeight=l(t.minHeight)?null:kh(t.minHeight,e.height,e),this._maxHeight=l(t.maxHeight)?null:kh(t.maxHeight,e.height,e),this._minWidth=l(t.minWidth)?null:kh(t.minWidth,e.width,e),this._maxWidth=l(t.maxWidth)?null:kh(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kh(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kh(t.height,e.height,e)},{height:9}),l(t.offsetX)||(this.layoutOffsetX=kh(t.offsetX,e.width,e)),l(t.offsetY)||(this.layoutOffsetY=kh(t.offsetY,e.height,e))}}setAttrFromSpec(t,e){var i,n,s,r,a;this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(n=t.layoutLevel)&&void 0!==n?n:this.layoutLevel,this.layoutOrient=null!==(s=t.orient)&&void 0!==s?s:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip,this.layoutZIndex=null!==(a=t.zIndex)&&void 0!==a?a:this.layoutZIndex}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{l(this._spec[i])||(e[i]=kh(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:n,right:s}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};l(n)||(r.width-=n),l(s)||(r.width-=s),l(e)||(r.height-=e),l(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const h={x:t.x,y:t.y};!0===this._spec.center?(h.x=t.x+.5*t.width-.5*a,h.y=t.y+.5*t.height-.5*o):(l(n)?l(s)||(h.x=t.x+t.width-this.layoutPaddingRight-s-a):h.x=t.x+n+this.layoutPaddingLeft,l(e)?l(i)||(h.y=t.y+t.height-this.layoutPaddingBottom-i-o):h.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(h)}setLayoutStartPosition({x:t,y:e}){_(t)&&(this._layoutStartPoint.x=t),_(e)&&(this._layoutStartPoint.y=e)}setLayoutRect({width:t,height:e},i){var n,s,r,a;_(t)&&(null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0),_(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)}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?(l(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),l(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(l(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),l(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){this._lastComputeRect=t;const e=Object.assign({},this.boundsInRect(this._setRectInSpec(t),t));return this.changeBoundsBySetting(e),this._autoIndent&&(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)),this._setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t))}boundsInRect(t,e){return{x1:0,y1:0,x2:t.width,y2:t.height}}updateLayoutAttribute(){}compile(){}}class yZ extends vZ{constructor(){super(...arguments),this.id=Co(),this._compiledProductId=null,this._depend=[]}getProduct(){if(h(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return h(e)&&h(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;h(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(h(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(h);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class _Z extends yZ{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,n){super(t),this.grammarType=sZ.signal,this.name=e,this._value=i,this._updateFunc=n}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}h(this._value)&&this._product.value(this._value),h(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class bZ extends vZ{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new _Z(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class xZ extends bZ{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),n=e[t];this.updateSignal(i,n)}))}updateState(t,e){return t?(D(this._stateMap,t),this.compile(t),e?Promise.resolve():this.getCompiler().reRenderAsync()):Promise.resolve()}}class SZ extends xZ{_getDefaultStateMap(){return{layoutUpdateRank:1}}updateLayoutState(){return this._stateMap.layoutUpdateRank++,this.updateState({layoutUpdateRank:this._stateMap.layoutUpdateRank})}}class wZ extends mZ{getData(){return this._data}getSpecIndex(){return this._specIndex}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}getMarkInfoList(){return this.getMarks().map((t=>({type:t.type,name:t.name})))}getChart(){return this._option.getChart()}getState(){return this.state._stateMap}get tooltipHelper(){return this._tooltipHelper}constructor(t,e){var i,n,s;super(e),this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._specIndex=0,this.specKey="",this._marks=new gZ,this._lastLayoutRect=null,this._isLayout=!0,this.id=Co(),this._originalSpec=t,this._spec=Oh(t),this.userId=t.id,this._specIndex=null!==(i=e.specIndex)&&void 0!==i?i:0,this.specKey=null!==(n=e.specKey)&&void 0!==n?n:"",this.effect={},this.event=new rq(e.eventDispatcher,e.mode),null===(s=e.map)||void 0===s||s.set(this.id,this),this._sceneNodeMap=new Map,this.state=new SZ(Object.assign(Object.assign({},e),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}))}_releaseEvent(){this.event.release()}created(){this._initTheme(),this.setAttrFromSpec()}updateState(t){return this.state.updateState(t)}init(t){}afterInit(){}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i),this._isLayout=!0}onLayoutEnd(t){const e=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,e)||this.updateLayoutAttribute(),this._forceLayoutTag=!1,this.getMarks().forEach((t=>t.updateLayoutState(!0,!0))),this._isLayout=!1}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}onEvaluateEnd(t){}onDataUpdate(){}release(){var t;this._releaseEvent(),this._originalSpec={},this._spec=void 0,this.getMarks().forEach((t=>t.release())),this.state.release(),null===(t=this._data)||void 0===t||t.release(),this._data=this._specIndex=this._sceneNodeMap=null,this._marks.clear(),super.release()}updateSpec(t){this._originalSpec=t,this._spec=Oh(t);return{change:!1,reMake:!1,reMakeData:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){this._initTheme(t),this.setAttrFromSpec()}_initTheme(t){this._theme=t,this._mergeMarkTheme()}_mergeMarkTheme(){var t,e;const i=null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t);if(l(i)||l(this._theme))return;const{mark:n,markByName:s}=i;this.getMarkInfoList().forEach((({type:t,name:e})=>{var i,r;this._theme[e]=Lh({},null!==(i=null==n?void 0:n[V(t)[0]])&&void 0!==i?i:{},null!==(r=null==s?void 0:s[e])&&void 0!==r?r:{},this._theme[e])}))}_mergeThemeToSpec(){if(this._shouldMergeThemeToSpec()){const t=this._getDefaultSpecFromChart(this.getChart().getSpec()),e=e=>Lh({},this._theme,this._prepareSpecBeforeMergingTheme(t),this._prepareSpecBeforeMergingTheme(e));f(this._originalSpec)?this._spec=this._originalSpec.map((t=>e(t))):this._spec=e(this._originalSpec)}this._prepareSpecAfterMergingTheme()}_getDefaultSpecFromChart(t){return{}}_shouldMergeThemeToSpec(){return!0}_prepareSpecBeforeMergingTheme(t){return t}_prepareSpecAfterMergingTheme(t){var e,i,n;arguments.length||(t=this._spec);const s=bc("spec",t,null===(n=null===(i=(e=this._option).getTheme)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.colorScheme,"series"===this.modelType?this.type:void 0);return arguments.length||(this._spec=s),s}setCurrentTheme(t,e){}updateLayoutAttribute(){}setAttrFromSpec(){super.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,n){h(t)&&h(e)&&t.setStyle(this._convertMarkStyle(e),i,n)}initMarkStyleWithSpec(t,e,i){if(!h(t)||!h(e))return;const{style:n,state:s}=e,r=Object.assign({},e);n&&(r.style=this._convertMarkStyle(n)),s&&(r.state={},Object.keys(s).forEach((t=>{r.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${IN}_${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})}))}compileSignal(){var t;null===(t=this.state)||void 0===t||t.compile()}bindSceneNode(t){this._sceneNodeMap.set(t.mark.id(),t)}getSceneNodes(){return Array.from(this._sceneNodeMap.values())}getSceneNodeMarks(){return this.getSceneNodes().map((t=>t.mark))}_createMark(t,e={}){const{type:i,name:n}=t,s=BN.createMark(i,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return null==s||s.created(),s}_getDataIdKey(){}}const AZ={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",rect:"M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",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"},kZ={symbol:function(t,e){var i;switch(t){case"shape":case"symbolType":return null!==(i=AZ[e])&&void 0!==i?i:e;default:return e}}},MZ={symbol:{shape:!0,symbolType:!0}};const CZ={};Object.values(rZ).forEach((t=>{CZ[t]=!0}));const TZ={[rZ.STATE_HOVER]:rZ.STATE_HOVER_REVERSE,[rZ.STATE_SELECTED]:rZ.STATE_SELECTED_REVERSE,[rZ.STATE_DIMENSION_HOVER]:rZ.STATE_DIMENSION_HOVER_REVERSE};function EZ(t){return TZ[t]}class PZ{constructor(){this._stateMarks=new Map,this._stateElements=new Map}static markStateEnable(t,e){return!C(t.stateStyle[e])}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;const n=EZ(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),n&&this.addEventElement(n,e)})),e.getStates().includes(t)||(e.addState(t),n&&e.removeState(n)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,n;e.removeState(t);const s=null!==(n=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==n?n:[];this._stateElements.set(t,s);const r=EZ(t);r&&(0===s.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;e.getStates().includes(t)||e.addState(t);const n=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];n.push(e),this._stateElements.set(t,n)}clearEventElement(t,e){var i;if(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e){const e=EZ(t);e&&this.clearEventElement(e,!1)}}reverseEventElement(t){const e=EZ(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const n=this.getEventElement(t);if(!n.length)return;this.getEventElement(e).length||(1===n.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==n[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!n.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}}class RZ extends xZ{constructor(){super(...arguments),this.id=Co(),this.stateKeyToSignalName=t=>`${IN}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===_q.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===_q.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?_q.none:_q.appear}}}}var OZ;!function(t){t.filter="filter",t.axis="axis"}(OZ||(OZ={}));class BZ extends wZ{getGroupMark(){return this._groupMark}constructor(t,e){var i;super(t,e),this.modelType="region",this.type=BZ.type,this._series=[],this.layoutType="region",this.layoutZIndex=PK.Region,this.interaction=new PZ,this.seriesDataFilterOver=()=>{this.event.emit(cK.regionSeriesDataFilterOver,{model:this}),this._series.forEach((t=>t.reTransformViewData()))},this.userId=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler})),h(t.zIndex)&&(this.layoutZIndex=t.zIndex)}_getClipDefaultValue(){var t,e,i,n;const s=this._option.getChart().getSpec(),r=null===(e=null===(t=s.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.filter)===OZ.axis})),a=null===(n=null===(i=s.scrollBar)||void 0===i?void 0:i.some)||void 0===n?void 0:n.call(i,(t=>{var e;return(null!==(e=t.filterMode)&&void 0!==e?e:OZ.axis)===OZ.axis}));return!(!r&&!a)||this.layoutClip}created(){var t,e;super.created(),this._groupMark=this._createMark({type:Hh.group,name:"regionGroup"}),this._groupMark.setUserId(this.userId),this._groupMark.setZIndex(this.layoutZIndex);const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this.setMarkStyle(this._groupMark,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:i},"normal",yK.Built_In),this.setMarkStyle(this._groupMark,{cornerRadius:null===(e=this._spec.style)||void 0===e?void 0:e.cornerRadius},"normal",yK.User_Mark),this._marks.addMark(this._groupMark),this._spec.style&&(this._backgroundMark=this._createMark({type:Hh.rect,name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:Hh.rect,name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yK.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setZIndex(0),this._foregroundMark&&this._foregroundMark.setZIndex(PK.Mark+1)),this.createTrigger()}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yK.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yK.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yK.User_Mark)}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.style&&!(null==t?void 0:t.style)||!e.style&&(null==t?void 0:t.style)?(i.reMake=!0,i):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,n;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||!e.userId||V(t.userId).includes(e.userId))&&(!h(t.specIndex)||!e.getSpecIndex||V(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===(n=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>t.getViewDataFilter())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new fZ(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in aZ)C(t.stateStyle[aZ[e]])||this.interaction.registerMark(aZ[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}}).layout(((t,e,i,n)=>{}))}))}compileSignal(){var t;super.compileSignal(),null===(t=this.animate)||void 0===t||t.compile()}compile(){this.compileSignal(),this.compileMarks()}bindSceneNode(t){this._sceneNodeMap.set("default",t)}}BZ.type="region";class IZ{constructor(t,e){this._leftCurrent=0,this._topCurrent=0,this._rightCurrent=0,this._bottomCurrent=0,this._onError=null==e?void 0:e.onError}layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalInlineItems(e.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType));if(this.layoutRegionItems(l,h),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this._rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this._bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this._bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),s=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;let o=0,l=this._leftCurrent,h=this._topCurrent;e.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(l+=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._leftCurrent=l+o;let c=0;l=this._leftCurrent,h=this._topCurrent,n.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,h+=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+t.layoutPaddingTop}))})),this._topCurrent=h+c,o=0;let d=this._rightCurrent;h=this._topCurrent,i.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,r=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:h+t.layoutOffsetY+t.layoutPaddingTop}),o=Math.max(o,r),h+=s,h>a&&(d-=o,o=r,h=this._topCurrent+s,t.setLayoutStartPosition({x:d+t.layoutOffsetX-n.width-t.layoutPaddingRight,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),this._rightCurrent=d-o,c=0,l=this._leftCurrent;let u=this._bottomCurrent;s.forEach(((t,e)=>{const i=this.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(i);t.setLayoutRect(n);const s=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,a=n.width+t.layoutPaddingLeft+t.layoutPaddingRight;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}),c=Math.max(c,s),l+=a,l>r&&(l=this._leftCurrent+a,u-=c,c=s,t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:u+t.layoutOffsetY-n.height-t.layoutPaddingBottom}))})),this._bottomCurrent=u-c}layoutRegionItems(t,e){let i=this._rightCurrent-this._leftCurrent,n=this._bottomCurrent-this._topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({width:i.width}),"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}))})),i=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect({height:i.height}),"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}))})),n=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:i,height:n}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const n=t.find((t=>t.id===e));return n||(null!==(i=this._onError)&&void 0!==i?i:_o)("can not find target region item, invalid id"),n}getItemComputeLayoutRect(t){return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t){const e={top:0,left:0,bottom:0,right:0},i=this._chartViewBox.x2-this._chartViewBox.x1-this._rightCurrent,n=this._chartViewBox.y2-this._chartViewBox.y1-this._bottomCurrent;return t.forEach((t=>{if(!t.getVisible()||!t.getAutoIndent())return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,r=t.getLastComputeOutBounds();s?(e.top=Math.max(e.top,r.y1-this._topCurrent),e.bottom=Math.max(e.bottom,r.y2-n)):(e.left=Math.max(e.left,r.x1-this._leftCurrent),e.right=Math.max(e.right,r.x2-i))})),e}}const DZ=[Hh.line,Hh.area,"trail"];function LZ(t){return DZ.includes(t)}class FZ extends xZ{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 n=t.fields[i];e.fields[i]=e.fields[i]||{};const s=e.fields[i];h(n.domain)&&(s.domain=n.domain),h(n.type)&&(s.type=n.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,n){var s;n=a(LZ)?n:!t.mark||LZ(t.mark.markType);let r=!1,o=!1;if(h(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,n),o=!0;else if(i.items)r=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,o=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,n),o=!0;else if(!r&&i.filter){const n={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,n),o=!0}return o?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!CZ[t])).map((t=>[t,10])),n=!t.mark||LZ(t.mark.markType);for(let s=0;st[0]))}checkDatumState(t,e,i){let n=!1;const s=i?e[0]:e;if(f(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(IN)));n=t.datums.some((t=>i&&f(null==t?void 0:t.items)?e.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])})):e.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(c(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(IN)));n=e.every((e=>{var n,r;return i?(null===(n=t.datums.items)||void 0===n?void 0:n[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else n=e===t.datums;return n}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,n){var s;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=n?null===(s=e[0])||void 0===s?void 0:s[a]:e[a];if(ol(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,n)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,n,s){var r;const a=s?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t){t.state({callback:(t,e)=>this.checkState(e,t)})}}class jZ extends yZ{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=sZ.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();return e&&i&&(e.values(i),!t)?this.getCompiler().reRenderAsync():Promise.resolve()}_compileProduct(){const t=this.getLatestData();l(t)||(l(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){const e=this.getVGrammarView();if(!e||!t)return;const i=this.getProductId();this._product=e.data(t).id(i),this._compiledProductId=i}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById(t)}}class zZ extends jZ{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return h(t)?t:`${IN}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct(e)}}class HZ extends yZ{getSupport3d(){return this._support3d}setSupport3d(t){this._support3d=t}getFacet(){return this._facet}setFacet(t){this._facet=t}getInteractive(){return this._interactive}setInteractive(t){this._interactive=t}getZIndex(){return this._zIndex}setZIndex(t){this._zIndex=t}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){h(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){l(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),h(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getMorph(){return this._morph}setMorph(t){this._morph=t}getMorphKey(){return this._morphKey}setMorphKey(t){this._morphKey=t}getMorphElementKey(){return this._morphElementKey}setMorphElementKey(t){this._morphElementKey=t}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}getLabelSpec(){return this._label}setLabelSpec(t){this._label=t}getProgressiveConfig(){return this._progressiveConfig}setProgressiveConfig(t){this._progressiveConfig=t}constructor(t,e,i){super(t),this.grammarType=sZ.mark,this.type=void 0,this.name="mark",this._interactive=!0,this._zIndex=PK.Mark,this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this._morph=!1,this.name=e,this.model=i,this.key=t.key,this.state=new FZ(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._option.support3d&&this.setSupport3d(!0),this._event=new rq(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new zZ(t)}stateKeyToSignalName(t){return`${IN}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,n){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(h(e)&&this.removeProduct());if(h(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),l(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){var t;if(l(this._data))return;this._data.compile();const e=this._data.getProduct();h(this._product)&&h(e)&&this._product.join(e,this.key,void 0,null!==(t=this._groupKey)&&void 0!==t?t:this._facet)}updateStaticEncode(){if(!this._product)return;const{enterStyles:t}=this._separateStyle();this._product.encodeState(this._facet?"group":"enter",t)}_separateStyle(){const t=this.stateStyle,e=rZ.STATE_NORMAL,i=t[e];vn(t,["symbol"==typeof e?e:e+""]);const n={},s={};return Object.keys(i).forEach((t=>{this._unCompileChannel[t]||(!function(t,e,i){var n;const s=null===(n=e[t])||void 0===n?void 0:n.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,s);return!!r||(!!o(s)||!(!(null==s?void 0:s.scale)||s.field===i))}(t,i,this.getFacet())?n[t]=this.compileCommonAttributeCallback(t,"normal"):s[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),{enterStyles:n,updateStyles:s}}compileEncode(){const t=this.stateStyle,e=rZ.STATE_NORMAL;t[e];const i=vn(t,["symbol"==typeof e?e:e+""]),{enterStyles:n,updateStyles:s}=this._separateStyle();this._product.encode(s),this._product.encodeState(this._facet?"group":"enter",n),Object.keys(i).forEach((t=>{const e={};Object.keys(i[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product)}compileAnimation(){var t,e;if(this._animationConfig){let i;if("component"===this.type)i=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=this.model.getRegion();i=null===(e=t.animate)||void 0===e?void 0:e.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,n)=>{var s;return null===(s=n[i])||void 0===s?void 0:s.callback(t,e)},dependency:i}),this._animationConfig.normal&&this._event.on(NV.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===_q.appear&&this.runAnimationByState(_q.normal)}))}}compileContext(){const t={interactive:this.getInteractive(),zIndex:this.getZIndex(),context:{markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},support3d:this.getSupport3d()};this._progressiveConfig&&(t.progressiveStep=this._progressiveConfig.progressiveStep,t.progressiveThreshold=this._progressiveConfig.progressiveThreshold,t.large=this._progressiveConfig.large,t.largeThreshold=this._progressiveConfig.largeThreshold),this._morph&&this._morphKey&&(t.morph=this._morph,t.morphKey=this._morphKey,t.morphElementKey=this._morphElementKey),this._product.configure(t)}compileSignal(){this.state.compile()}compileCommonAttributeCallback(t,e){const i=(n=this.type,s=t,!(MZ[n]&&MZ[n][s]));var n,s;const r={mark:null,parent:null,element:null};return(n,s)=>(r.mark=s.mark,r.parent=s.mark.group,r.element=s,i?this.getAttribute(t,n,e,r):function(t,e,i){return kZ[t]?kZ[t](e,i):i}(this.type,t,this.getAttribute(t,n,e,r)))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}release(){super.release(),this.state.release()}}class NZ extends HZ{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(h(t.id)&&(this._userId=t.id),a(t.interactive)&&(this._interactive=t.interactive),h(t.zIndex)&&this.setZIndex(t.zIndex),a(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}convertAngleToRadian(t){if(y(t))return Xo(t);if(t.scale){const e=t.scale.range();return t.scale.range(e.map(Xo)),t}return"function"==typeof t?(e,i,n,s)=>Xo(t(e,i,n,s)):t}isUserLevel(t){return[yK.User_Mark,yK.User_Series,yK.User_Chart].includes(t)}setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;t=this._filterStyle(t,e,i,n),void 0===n[e]&&(n[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];l(a)||(a=this._filterAttribute(r,a,e,i,s,n),this.setAttribute(r,a,e,i,n))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterStyle(t,e,i,n=this.stateStyle){return t}_filterAttribute(t,e,i,n,s,r=this.stateStyle){let a=this._styleConvert(e);return s&&"angle"===t&&(a=this.convertAngleToRadian(a)),a}setReferer(t,e,i,n=this.stateStyle){var s;if(t)if(e&&i){const r=null!==(s=n[i])&&void 0!==s?s:{[e]:{}};n[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(n).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{n[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var n;(null===(n=this.stateStyle[i])||void 0===n?void 0:n[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",n){return this._computeAttribute(t,e,i,n)}setAttribute(t,e,i="normal",n=0,s=this.stateStyle){var r;void 0===s[i]&&(s[i]={}),void 0===s[i][t]&&(s[i][t]={level:n,style:e,referer:void 0});const a=null===(r=s[i][t])||void 0===r?void 0:r.level;h(a)&&a<=n&&Lh(s[i][t],{style:e,level:n}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===s[i][t]&&(s[i][t]=s.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ll(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return g(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.dataStatistics):t.scale;const i=_h(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,dataStatistics:this._option.dataStatistics});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e,i,n){var s;let r=null===(s=this.stateStyle[i])||void 0===s?void 0:s[t];r||(r=this.stateStyle.normal[t]);let a=this._computeStateAttribute(r,t,e,i,n);return o(null==r?void 0:r.postProcess)&&(a=r.postProcess(a,e,this._attributeContext,n,this.getDataView())),t in this._computeExChannel?this._computeExChannel[t](t,e,i,n,a):a}_computeStateAttribute(t,e,i,n,s){var r;if(t)return t.referer?t.referer.getAttribute(e,i,n,s):"function"==typeof t.style?t.style(i,this._attributeContext,s,this.getDataView()):OK.includes(t.style.gradient)?this._computeGradientAttr(t.style,i,s):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style,i,s):"threshold"===t.style.type?this._computeThresholdAttr(t.style):ll(null===(r=t.style.scale)||void 0===r?void 0:r.type)?t.style.scale.scale(i[t.style.field]):t.style}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yK.User_Mark,e);const n=t.state;n&&Object.keys(n).forEach((t=>{const i=n[t];if("style"in i){const n=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=o(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(n,t,yK.User_Mark,e)}else this.setStyle(i,t,yK.User_Mark,e)}))}_computeGradientAttr(t,e,i){var n,s;const{gradient:r,scale:a,field:l}=t,c=vn(t,["gradient","scale","field"]),d=this.getDataView();let u=a,p=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();a||(u=t),p||(p=e)}const g=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain()),f={},v=Object.assign(Object.assign({},BK[r]),c);return Object.keys(v).forEach((t=>{const n=v[t];"stops"===t?f.stops=n.map((t=>{const{opacity:n,color:s,offset:r}=t;let a=null!=s?s:null==u?void 0:u.scale(e[p]);return o(s)&&(a=s(e,this._attributeContext,i,d)),h(n)&&(a=mo.SetOpacity(a,n)),{offset:o(r)?r(e,this._attributeContext,i,d):r,color:a||g[0]}})):o(n)?f[t]=n(e,this._attributeContext,i,d):f[t]=n})),f.gradient=r,f}_computeBorderAttr(t,e,i){var n,s,r;const{scale:a,field:l}=t,h=vn(t,["scale","field"]),c={};if(Object.keys(h).forEach((t=>{const n=h[t];o(n)?c[t]=n(e,this._attributeContext,i,this.getDataView()):c[t]=n})),"stroke"in c)OK.includes(null===(r=h.stroke)||void 0===r?void 0:r.gradient)&&(c.stroke=this._computeGradientAttr(h.stroke,e,i));else{const t=uh(dh(null===(s=null===(n=this.model.getOption())||void 0===n?void 0:n.getTheme())||void 0===s?void 0:s.colorScheme,"series"===this.model.modelType?this.model.type:void 0),this.model.getDefaultColorDomain());let i=a,r=l;if(!(a&&l||"series"!==this.model.modelType)){const{scale:n,field:s}=this.model.getColorAttribute();a||(i=n),r||(r=s),c.stroke=(null==i?void 0:i.scale(e[r]))||t[0]}}return c}_computeThresholdAttr(t){return(new ah).domain(t.domain).range(t.range).scale(this.getDataView().latestData[0].value)}}class VZ extends NZ{constructor(){super(...arguments),this.type=VZ.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{clip:!1})}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(yo("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?(yo("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this.getZIndex()}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}VZ.type=Hh.group;class WZ extends NZ{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(OV.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}WZ.type=Hh.component;class GZ extends NZ{constructor(){super(...arguments),this.type=GZ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}GZ.type=Hh.image,pZ.useMark([WZ,VZ,GZ]),BN.registerRegion("region",BZ),BN.registerLayout("base",IZ);qe.getInstance(Ke.Error);const UZ={type:"clipIn"},YZ={type:"fadeIn"};function XZ(t,e){if(!1===e)return{};switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return YZ;default:return UZ}}function $Z(t,e=!0){return(i,n,s)=>{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 KZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:$Z(t,e)}),qZ=(t,e=!0)=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:$Z(t,e)}),ZZ={type:"fadeIn"},JZ={type:"growCenterIn"};function QZ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZZ;case"scaleIn":return JZ;default:return KZ(t)}}const tJ={type:"clipIn"},eJ={type:"fadeIn"};function iJ(t,e){switch(e){case"grow":return(t=>({type:t.direction===HK.horizontal?"growPointsXIn":"growPointsYIn",options:{orient:t.direction===HK.horizontal?"positive":"negative"}}))(t);case"fadeIn":return eJ;default:return tJ}}function nJ(t,e,i){return(n,s,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(n,s,i)}:{overall:!1}}const sJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:nJ(t,!0,_q.appear)}),rJ={type:"fadeIn"},aJ=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:nJ(t,!0,_q.enter)}),oJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:nJ(t,!0,_q.exit)}),lJ=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:nJ(t,!0,_q.exit)});function hJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rJ;case"growRadius":return sJ(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sJ(Object.assign(Object.assign({},t),{growField:"angle"}))}}const cJ={type:"fadeIn"};function dJ(t,e){return"fadeIn"===e?cJ:(t=>({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}function uJ(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const pJ=t=>({type:t.direction===HK.horizontal?"growWidthOut":"growHeightOut",options:uJ(t)}),gJ={type:"fadeIn"};function fJ(t,e){return!1===e?{}:"fadeIn"===e?gJ:(t=>({type:t.direction===HK.horizontal?"growWidthIn":"growHeightIn",options:uJ(t)}))(t)}const vJ=t=>({type:"in"===t?"fadeIn":"fadeOut"});function mJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function yJ(t,e,i){return"fadeIn"===e?vJ(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},n=(t,e)=>e.getGraphicAttribute("x"),s=()=>{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:n},y:{from:s,to:r}}}:{channel:{x:{from:n,to:i},y:{from:r,to:s}}}})(t,i)}const _J=(t,e)=>({custom:uT,customParameters:(i,n)=>{var s;return{group:n.getGraphicItem(),startAngle:null!==(s=t.startAngle)&&void 0!==s?s:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}});class bJ extends HC{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;o(r)&&o(a)||(this.valid=!1),this._pointToCoord=r,this._coordToPoint=a}getEndProps(){return!1===this.valid?{}:this._coordToPoint({angle:this._toAngle,radius:this._toRadius})}onBind(){const{angle:t,radius:e}=this._pointToCoord(this.from);_(t*e)||(this.valid=!1),this._fromAngle=t,this._fromRadius=e;const{angle:i,radius:n}=this._pointToCoord(this.to);_(i*n)||(this.valid=!1),this._toAngle=i,this._toRadius=n}onUpdate(t,e,i){if(!1!==this.valid)if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e}else{const{x:t,y:n}=this._coordToPoint({angle:this._fromAngle+(this._toAngle-this._fromAngle)*e,radius:this._fromRadius+(this._toRadius-this._fromRadius)*e});i.x=t,i.y=n}}}class xJ extends cT{constructor(t,e,i,n,s){super(t,e,i,n,s);const r=this.params.pointToCoord,a=this.params.coordToPoint;this._pointToCoord=r,this._coordToPoint=a}onUpdate(t,e,i){this.points=this.points.map(((t,i)=>{const n=this.polarPointInterpolation(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return n.context=t.context,n})),i.points=this.points}polarPointInterpolation(t,e,i){const n=this._pointToCoord(t),s=this._pointToCoord({x:t.x1,y:t.y1}),r=this._pointToCoord(e),a=this._pointToCoord({x:e.x1,y:e.y1}),o=n.angle+(r.angle-n.angle)*i,l=n.radius+(r.radius-n.radius)*i,h=s.angle+(a.angle-s.angle)*i,c=s.radius+(a.radius-s.radius)*i,{x:d,y:u}=this._coordToPoint({angle:o,radius:l}),{x:p,y:g}=this._coordToPoint({angle:h,radius:c}),f=new Gt(d,u,p,g);return f.defined=e.defined,f}}const SJ=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("innerRadius")},outerRadius:{from:e,to:(t,e)=>e.getGraphicAttribute("outerRadius")}}}},wJ={type:"fadeIn"},AJ=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),kJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),MJ=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function CJ(t,e){if(!1===e)return{};switch(e){case"fadeIn":return wJ;case"growAngle":return SJ(Object.assign(Object.assign({},t),{growField:"angle"}));default:return SJ(Object.assign(Object.assign({},t),{growField:"radius"}))}}const TJ={type:"fadeIn"},EJ={type:"growCenterIn"};function PJ(t,e){switch(e){case"fadeIn":return TJ;case"scaleIn":return EJ;default:return KZ(t,!1)}}const RJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},OJ=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),BJ={type:"fadeIn"},IJ=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function DJ(t,e){return"fadeIn"===e?BJ:OJ(t)}const LJ=t=>({custom:gT,customParameters:(e,i)=>t,easing:"linear",loop:1/0,duration:6e3}),FJ=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},jJ=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},zJ=t=>{const e=t.mark.elements.filter((t=>t.diffState===RV.update)),i=Math.min(...e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},HJ=(t,e,i)=>{if(C(t))return[e,i];const n=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),s=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[n,s]},NJ=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.startAngle,a)*(s-n)+n},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=HJ(r,n,s);return jJ(e.endAngle,a)*(s-n)+n},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),VJ=t=>{const e=Math.min(...t.map((t=>t.getGraphicAttribute("startAngle",!1)))),i=Math.max(...t.map((t=>t.getGraphicAttribute("endAngle",!1))));return[e,i]},WJ=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("startAngle",!1),a)*(s-n)+n}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:n,endAngle:s}=t.animationInfo(),r=zJ(i),a=VJ(r);return jJ(i.getGraphicAttribute("endAngle",!1),a)*(s-n)+n}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),GJ=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"growRadiusIn"},UJ={type:"fadeIn"};function YJ(t){return!1===t?{}:UJ}const XJ={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"}},$J={bar:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),bar3d:(t,e)=>({appear:QZ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t)}),line:(t,e)=>({appear:iJ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:cT,duration:XJ.update.duration,easing:XJ.update.easing}],disappear:{type:"clipOut"}}),area:(t,e)=>({appear:XZ(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"clipOut"}}),pie:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),pie3d:(t,e)=>({appear:hJ(t,e),enter:aJ(t),exit:oJ(t),disappear:lJ(t)}),rose:(t,e)=>({appear:CJ(t,e),enter:AJ(t),exit:kJ(t),disappear:MJ(t)}),radar:(t,e)=>({appear:"clipIn"===e?void 0:mJ(t,e,"in"),enter:mJ(t,e,"in"),exit:mJ(t,e,"out"),disappear:"clipIn"===e?void 0:mJ(t,e,"out"),update:[{options:{excludeChannels:"points"}},{channel:["points"],custom:xJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarSymbol:(t,e)=>({appear:"clipIn"===e?void 0:yJ(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:yJ(t,e,"out"),update:[{options:{excludeChannels:["x","y"]}},{channel:["x","y"],custom:bJ,customParameters:t,duration:XJ.update.duration,easing:XJ.update.easing}]}),radarGroup:(t,e)=>({appear:_J(t,"in"),disappear:_J(t,"out")}),circularProgress:(t,e)=>({appear:dJ(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}}),scatter:(t,e)=>({appear:RJ(0,e),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),progressBackground:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),linearProgress:(t,e)=>({appear:fJ(t,e),enter:{type:"grow"},disappear:pJ(t)}),symbol:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),label:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),path:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel:(t,e)=>({appear:"clipIn"===e?void 0:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),funnel3d:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),cartesianGroup:t=>({appear:{custom:pT,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:pT,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}),wordCloud:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),wordCloud3d:t=>({appear:LJ(t)}),rangeColumn:(t,e)=>({appear:DJ(t,e),enter:OJ(t),exit:IJ(t),disappear:IJ(t)}),waterfall:(t,e)=>({appear:PJ(t,e),enter:KZ(t,!1),exit:qZ(t,!1),disappear:qZ(t,!1)}),boxPlot:()=>({appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}}),treemap:()=>({appear:{type:"growCenterIn"},enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}),sankeyNode:()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),sankeyLinkPath:()=>({appear:{type:"linkPathGrowIn"},enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}),sunburst:(t,e)=>({appear:FJ(0,e),enter:NJ(t),exit:WJ(t),disappear:WJ(t)}),circlePacking:(t,e)=>({appear:GJ(0,e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}}),heatmap:(t,e)=>({appear:YJ(e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}),axis:()=>({appear:{custom:OY},update:{custom:RY},exit:{custom:fT}})},KJ=["appear","enter","update","exit","disappear","normal"];function qJ(t,e,i){var n;const s={};for(let r=0;r{const a=e(t),l=o(n)?n(t,s,r):_(n)?n:0;let h=o(i)?i(t,s,r):i;return!1===h?0:(h=!0===h?0:h,a*(l+h))},delete t.oneByOne,t}function QJ(t){return null==t?void 0:t[gK]}function tQ(t,e,i){return!1!==t&&(!1!==(null==i?void 0:i.appear)&&!1!==(null==i?void 0:i.update)&&!1!==(null==e?void 0:e.enable))}function eQ(t){return!function(t){return h(t.timeSlices)}(t)&&h(t.channel)}class iQ{initLineMark(t,e){return this._lineMark=this._createMark(Gh.line,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:null==e||e,progressive:t}),this._lineMark}initLineMarkStyle(t,e){var i,n,s;const r=this._lineMark;if(r){if(this.setMarkStyle(r,{stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(r,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(r,"defined")})),"polar"===this.coordinate)this.setMarkStyle(r,{lineJoin:"bevel",curveType:jK},"normal",yK.Series);else{const s=null!=e?e:null===(n=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===n?void 0:n.curveType,a=s===FK?t===HK.vertical?"monotoneX":"monotoneY":s;this.setMarkStyle(r,{curveType:a},"normal",yK.Built_In)}this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.dimension.add(r)}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,e){if(this._symbolMark=this._createMark(Gh.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!!e}),!0===this._spec.activePoint){const t=new go(this._option.dataSet,{name:`${IN}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:"active_point",type:Hh.symbol},{morph:!1,groupKey:this._seriesField,label:null,isSeriesMark:!1,dataView:t}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){var t;const e=this._symbolMark;if(!e)return e;if(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(e,"visible")})),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(nq.dimensionHover,this._dimensionTrigger.bind(this));for(const t in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[t]={};for(const i in this._symbolMark.stateStyle[t])this._symbolActiveMark.stateStyle[t][i]={style:null,level:yK.Series,referer:e}}this._symbolActiveMark.state.changeStateInfo({stateValue:rZ.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}initLabelMarkStyle(t){t&&(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},"normal",yK.Series),this.event.on(cK.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}encodeDefined(t,e){var i,n;if(!t)return;const s=null===(n=null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData)||void 0===n?void 0:n[this.getStackValueField()];"zero"===this._invalidType||s&&(null==s?void 0:s.allValid)?this.setMarkStyle(t,{[e]:!0},"normal",yK.Series):this.setMarkStyle(t,{[e]:this._getInvalidDefined},"normal",yK.Series)}}const nQ=(t,e)=>{const i=e.beforeCall();return t.forEach(((t,n)=>e.call(t,n,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sQ={[t.RenderModeEnum["desktop-miniApp"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["desktop-browser"]]:{hover:{enable:!0,trigger:"pointermove",triggerOff:["pointermove","pointerleave"]},select:{enable:!0,trigger:"pointertap"}},[t.RenderModeEnum["mobile-browser"]]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.miniApp]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}},[t.RenderModeEnum.lynx]:{hover:{enable:!0,trigger:"pointerover",triggerOff:"pointerout"},select:{enable:!0,trigger:"tap"}}};class rQ{get hover(){return this._hover}get select(){return this._select}constructor(t,e){this._fields=null,this._marks=new gZ,this._markReverse=new gZ,this.onHover=t=>{this.filterEventMark(t)&&this.hoverItem(t)},this.onUnHover=t=>{this.filterEventMark(t)||this.interaction.filterEventMark(t,rZ.STATE_HOVER)||this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&this.unhoverItem()},this.onSelect=t=>{this.handleSingleEventSelect(t)},this.onUnSelect=t=>{this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()},this._spec=t,this._option=e,this.event=new rq(e.eventDispatcher,e.mode),this.interaction=e.interaction,this.initConfig(e.mode)}setStateKeys(t){this._fields=[...t]}registerMark(t){this._marks.addMark(t),this._hover.enable&&this.interaction.registerMark(rZ.STATE_HOVER,t),this._select.enable&&this.interaction.registerMark(rZ.STATE_SELECTED,t)}init(){this.initEvent()}release(){this.releaseEvent(),this._marks.clear()}initEvent(){const t=this.event,{enable:e,trigger:i,triggerOff:n}=this._hover,{enable:s,trigger:r,triggerOff:a}=this._select;e&&(V(i).forEach((e=>{t.on(e,{level:uK.chart},this.onHover)})),n&&"none"!==n&&V(n).forEach((e=>{t.on(e,{level:uK.vchart,source:dK.chart},this.onUnHover)}))),s&&(V(r).forEach((e=>{t.on(e,{level:uK.mark},this.onSelect)})),a&&"none"!==a&&V(a).forEach((e=>{t.on(e,{level:uK.mark},this.onUnSelect)})),a||V(null!=a?a:r).forEach((e=>{t.on(e,{level:uK.vchart},this.onUnSelect)})))}releaseEvent(){this.event.release()}initConfig(t){const e=sQ[t];this._hover=Object.assign({},null==e?void 0:e.hover),this._select=Object.assign({},null==e?void 0:e.select);const i=this._spec.hover;a(i)?this._hover.enable=i:c(i)&&(this._hover.enable=!0,this._hover=Lh(this._hover,i));const n=this._spec.select;a(n)?this._select.enable=n:c(n)&&(this._select.enable=!0,this._select=Lh(this._select,n))}hoverItem(t){const{datum:e}=t,i=this.interaction.getEventElement(rZ.STATE_HOVER)[0];t.item!==i&&(this.interaction.exchangeEventElement(rZ.STATE_HOVER,t.item),this.interaction.reverseEventElement(rZ.STATE_HOVER),this.event.emit("hovered",{model:this._option.model,value:[e]}))}unhoverItem(){const t=this.interaction.getEventElementData(rZ.STATE_HOVER);this.interaction.clearEventElement(rZ.STATE_HOVER,!0),this.event.emit("unhovered",{model:this._option.model,value:t})}handleSingleEventHover(t){this.filterEventMark(t)?this.hoverItem(t):this.interaction.getEventElement(rZ.STATE_HOVER)[0]&&!this.interaction.filterEventMark(t,rZ.STATE_HOVER)&&this.unhoverItem()}selectItems(t){this.event.emit("selected",{model:this._option.model,value:t})}clearSelectedItems(){const t=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.interaction.clearEventElement(rZ.STATE_SELECTED,!0),this.event.emit("unselected",{model:this._option.model,value:t})}unselectItems(t){this.interaction.removeEventElement(rZ.STATE_SELECTED,t.item),this.event.emit("unselected",{model:this._option.model,value:t.item})}handleSingleEventSelect(t){if(this.filterEventMark(t))if(t.item.getStates().includes(rZ.STATE_SELECTED))this.unselectItems(t);else{if("multiple"===this._select.mode)this.interaction.addEventElement(rZ.STATE_SELECTED,t.item);else this.interaction.exchangeEventElement(rZ.STATE_SELECTED,t.item);this.interaction.reverseEventElement(rZ.STATE_SELECTED);const e=this.interaction.getEventElementData(rZ.STATE_SELECTED);this.selectItems(e)}else this.interaction.filterEventMark(t,rZ.STATE_SELECTED)||this.clearSelectedItems()}filterEventMark(t){return!(!t.mark||!this._marks.includes(t.mark))}isDatumEqual(t,e){return(this._fields?this._fields:Object.keys(t)).every((i=>t[i]===e[i]))}}class aQ{constructor(){this.activeTriggerSet={mark:new Set,dimension:new Set},this.ignoreTriggerSet={mark:new Set,dimension:new Set}}}const oQ=(t,e)=>h(e)?t.map((t=>e[t])):void 0,lQ=(t,e)=>i=>t.every(((t,n)=>i[t]===(null==e?void 0:e[n]))),hQ=t=>!l(t)&&(f(t)?t.length>0&&t.every(h):Object.keys(t).length>0);function cQ(t,e,i,n){var s,r,a,o,c;const d=Object.assign({regionIndex:0},e),u=n.getRegionsInUserIdOrIndex(h(d.regionId)?[d.regionId]:void 0,h(d.regionIndex)?[d.regionIndex]:void 0)[0];if(!u)return"none";const p=u.getSeries(),g=[];p.forEach((e=>{var i,n,s,r,a,o,c,d;const u=e.getDimensionField(),p=e.getMeasureField(),f=e.getSeriesField(),v=h(f)?t[f]:void 0,m=h(f)&&null!==(r=null===(s=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[f])||void 0===s?void 0:s.values)&&void 0!==r?r:[],y=oQ(u,t);let _=oQ(p,t);const b=hQ(_),x=!b&&h(f)&&l(v)&&m.length>0;if("cartesian"===e.coordinate){const t=e,i=u.map(((t,e)=>[t,e])).filter((([,t])=>l(null==y?void 0:y[t])));let n=[null!=y?y:[]];i.length>0&&i.forEach((([t,i])=>{var s,r,a,o;const l=null!==(o=null===(a=null===(r=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===r?void 0:r.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];n.forEach((t=>{l.forEach((e=>{const n=[...null!=t?t:[]];n[i]=e,h.push(n)}))})),n=h})),n.forEach((i=>{var n,s;if(x){const s=null===(n=t.getViewData())||void 0===n?void 0:n.latestData.filter(lQ(u,i));m.forEach((n=>{const r=s.find((t=>t[f]===n));if(_=oQ(p,r),!hQ(_))return;const a=t.dataToPosition(r);l(a)||isNaN(a.x)||isNaN(a.y)||g.push({pos:a,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const n=null===(s=t.getViewData())||void 0===s?void 0:s.latestData.find(lQ(u,i));if(!b&&(_=oQ(p,n),!hQ(_)))return;const r=t.dataToPosition(n);if(l(r)||isNaN(r.x)||isNaN(r.y))return;g.push({pos:r,data:{dimensionFields:u,dimensionData:i,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}))}else if("polar"===e.coordinate)if(e.type===Fh.pie){const t=e,i=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToCentralPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}else{const t=e;if(x){const i=(null===(o=t.getViewData())||void 0===o?void 0:o.latestData.filter(lQ(u,y))).find((t=>t[f]===v));m.forEach((n=>{if(_=oQ(p,i),!hQ(_))return;const s=t.dataToPosition(i);l(s)||isNaN(s.x)||isNaN(s.y)||g.push({pos:s,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:n},series:e})}))}else{const i=null===(c=t.getViewData())||void 0===c?void 0:c.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}else if("geo"===e.coordinate){const t=e,i=null===(d=t.getViewData())||void 0===d?void 0:d.latestData.find(lQ(u,y));if(!b&&(_=oQ(p,i),!hQ(_)))return;const n=t.dataToPosition(i);if(l(n)||isNaN(n.x)||isNaN(n.y))return;g.push({pos:n,data:{dimensionFields:u,dimensionData:y,measureFields:p,measureData:_,hasMeasureData:b,groupField:f,groupData:v},series:e})}}));const f=null!==(s=d.activeType)&&void 0!==s?s:g.length>1?"dimension":"mark",v=u.getLayoutStartPoint(),m=u.getLayoutRect(),y=n.globalInstance.getContainer(),_=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),b=t=>{var e;const{dimensionFields:i,dimensionData:n,measureFields:s,measureData:r,groupField:a,groupData:o}=t.data,h=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lQ(i,n)(t)&&lQ(s,r)(t)&&(l(a)||lQ([a],[o])(t))));return h},x=t=>{var e,i;const n=(t=>({x:Math.min(Math.max(t.x,0),m.width),y:Math.min(Math.max(t.y,0),m.height)}))(t),s=null!==(e=d.x)&&void 0!==e?e:v.x+n.x,r=null!==(i=d.y)&&void 0!==i?i:v.y+n.y;return{canvasX:s,canvasY:r,clientX:_.x+s,clientY:_.y+r}};if("dimension"===f){const e=g[0];if(!e)return"none";const s=new Map;g.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 o=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>b(t))))&&void 0!==i?i:[]}}))}],l={changePositionOnly:!1,dimensionInfo:o,chart:null!==(r=n.globalInstance.getChart())&&void 0!==r?r:void 0,datum:void 0,model:void 0,source:dK.chart,event:x({x:g.reduce(((t,e)=>t+e.pos.x),0)/g.length,y:g.reduce(((t,e)=>t+e.pos.y),0)/g.length}),item:void 0,itemMap:new Map};null===(a=null==i?void 0:i.showTooltip)||void 0===a||a.call(i,f,o,l);const h=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(h.id),f}if("mark"===f){const e=g[0];if(!e)return"none";const s=Object.assign(Object.assign({},b(e)),t),r={changePositionOnly:!1,chart:null!==(o=n.globalInstance.getChart())&&void 0!==o?o:void 0,datum:s,model:e.series,source:dK.chart,event:x(e.pos),item:void 0,itemMap:new Map};null===(c=null==i?void 0:i.showTooltip)||void 0===c||c.call(i,f,[{datum:[s],series:e.series}],r);const a=n.globalInstance;return pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),f}return"none"}const dQ=t=>{var e,i;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)};return h(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]))};class uQ extends aQ{constructor(t){super(),this._getSeriesCacheInfo=()=>{var t,e,i;const{series:n}=this,s=n.getSeriesField();return{seriesFields:h(s)?V(s):null!==(t=n.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=n.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=n.getMeasureField())&&void 0!==i?i:[],type:n.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._getSeriesStyle=(t,e,i)=>{var n;for(const i of V(e)){const e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(h(e))return e}return i},this.contentKeyCallback=(t,e)=>{const{dimensionFields:i,seriesFields:n}=this._seriesCacheInfo,s=i[i.length-1];return h(n[0])&&(null==t?void 0:t[n[0]])?null==t?void 0:t[n[0]]:(i.length>1&&(0===n.length||this.series.getSeriesKeys().length),null==t?void 0:t[s])},this.contentValueCallback=(t,e)=>this._getMeasureData(t),this.contentShapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.contentShapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.titleValueCallback=(t,e)=>this._getDimensionData(t),this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t,e,i,n;const s=null!==(e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip)&&void 0!==e?e:{},r=null!==(n=null===(i=this.series.getChart().getSpec())||void 0===i?void 0:i.tooltip)&&void 0!==n?n:{},a=Object.assign(Object.assign({},r),s);["mark","dimension"].forEach((t=>{const e=a[t];h(e)&&(a[t]=Object.assign(Object.assign({},e),{title:h(e.title)?o(e.title)?e.title:Object.assign(Object.assign({},e.title),{seriesId:this.series.id}):void 0,content:h(e.content)?o(e.content)?e.content:V(e.content).map((t=>o(t)?t:Object.assign(Object.assign({},t),{seriesId:this.series.id}))):void 0}))})),this.spec=a,this.activeType=dQ(a),this._seriesCacheInfo=this._getSeriesCacheInfo()}getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{seriesId:this.series.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const pQ={min:t=>t.length?Math.min.apply(null,t):0,max:t=>t.length?Math.max.apply(null,t):0,"array-min":t=>t.length?Math.min.apply(null,t):0,"array-max":t=>t.length?Math.max.apply(null,t):0,values:t=>{const e={},i=[];for(const n of t)e[n]||(i.push(n),e[n]=1);return i}},gQ=(t,e)=>{var i,n,s;const r={};let a=e.fields;if(o(a)&&(a=a()),!(null==a?void 0:a.length)||!(null==t?void 0:t.length))return r;const h=null===(i=e.sourceStatistics)||void 0===i?void 0:i.call(e),c=e.fieldFollowSource;a=AN([],a);const d="parser"===e.target?"parserData":"latestData",u=t[0][d]?t[0][d]:t||[],p=null===(s=(n=t[0]).getFields)||void 0===s?void 0:s.call(n);return a.forEach((t=>{const e=t.key;r[e]={};const i=null==p?void 0:p[e];if(h&&c&&c(e)&&h[e])return void(r[e]=h[e]);const n=t.operations,s=n.some((t=>"min"===t||"max"===t||"allValid"===t));let a=!0,o=u.reduce(((t,i)=>(i&&t.push(i[e]),t)),[]);const d=o.length;s?(o=o.filter(To),a=o.length===d):o=n.some((t=>"array-min"===t||"array-max"===t))?o.reduce(((t,e)=>(e&&e.forEach((e=>{To(e)&&t.push(e)})),t)),[]):o.filter((t=>void 0!==t)),n.forEach((n=>{if(t.customize)r[e][n]=t.customize;else{if(i&&i.lockStatisticsByDomain&&!l(i.domain)){if("values"===n)return void(r[e][n]=[...i.domain])}else if("allValid"===n)return;r[e][n]=pQ[n](o),"array-max"===n&&(r[e].max=r[e][n]),"array-min"===n&&(r[e].min=r[e][n])}})),s&&(r[e].allValid=a)})),r},fQ=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:n,checkField:s}=i();return"zero"!==n||t.forEach((t=>{To(t[s])||(t[s]=0)})),t};class vQ extends jZ{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;l(e)||h(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const mQ=`${IN}_HIERARCHY_DEPTH`,yQ=`${IN}_HIERARCHY_ROOT`,_Q=`${IN}_HIERARCHY_ROOT_INDEX`,bQ=()=>({keyMap:new Map});function xQ(t,e,i){t&&(this._seriesField||(t[vK]=this.getSeriesKeys()[0]),t[gK]=e,t[fK]=this.generateDefaultDataKey(this._spec.dataKey,t,e,i))}function SQ(t,e,i,n=0,s,r){void 0===r&&(r=e),xQ.bind(this)(t,e,i),t[mQ]=n,t[yQ]=s||t[this.getCategoryField()],t[_Q]=r,t.children&&t.children.length&&t.children.forEach(((e,n)=>SQ.bind(this)(e,n,i,t[mQ]+1,t[yQ],r)))}class wQ extends wZ{getTrigger(){return this._trigger}getRegion(){return this._region}getRootMark(){return this._rootMark}getRawData(){return this._rawData}getRawDataStatistics(){return this._rawDataStatistics}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){h(t)&&(this._seriesField=t,this.getMarks().filter((t=>t.getDataView()===this.getViewData())).forEach((t=>{t.setFacet(this._seriesField)})))}getGroups(){return this._groups}getStack(){return this._stack}getPercent(){return this._percent}getStackOffsetSilhouette(){return this._stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}constructor(t,e){var i;super(t,Object.assign({},e)),this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.coordinate="none",this._region=null,this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this._stack=!1,this._percent=!1,this._stackOffsetSilhouette=!1,this._invalidType="break",this._getInvalidDefined=t=>To(t[this.getStackValueField()]),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(cK.afterInitData,{model:this}),this.initTrigger(),this.initTooltip(),this.initRootMark(),this.initMark(),this._initExtensionMark(),this.initMarkStyle(),this.initMarkState(),!1!==this._spec.animation&&h(this._region.animate)&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(cK.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={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 l(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),a(this._spec.stack)&&(this._stack=this._spec.stack),a(this._spec.percent)&&(this._percent=this._spec.percent,this._stack=this._spec.percent||this._stack),a(this._spec.stackOffsetSilhouette)&&(this._stackOffsetSilhouette=this._spec.stackOffsetSilhouette,this._stack=this._spec.stackOffsetSilhouette||this._stack),h(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType),null===(t=this._tooltipHelper)||void 0===t||t.updateTooltipSpec()}initData(){var t,e,i;if(this._rawData=this._spec.data,null===(t=this._rawData)||void 0===t||t.target.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this._viewDataFilter=vq(this._rawData,this._dataSet,{name:`${IN}_series_${this.id}_viewDataFilter`});const t=vq(this._viewDataFilter,this._dataSet,{name:`${IN}_series_${this.id}_viewData`});this._data=new vQ(this._option,t),this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}"zero"===this._invalidType&&(null===(e=this._rawData)||void 0===e?void 0:e.dataSet)&&(hq(this._rawData.dataSet,"invalidTravel",fQ),null===(i=this._rawData)||void 0===i||i.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getStackValueField()})}},!1))}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._rawData&&this._statisticRawData(),this._data&&this._statisticViewData()}_statisticRawData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=new go(this._dataSet,{name:t}),this._rawDataStatistics.parse([this._rawData],{type:"dataview"}),this._rawDataStatistics.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const e=AN(this.getStatisticFields(),null!==(t=this._option.globalScale.getStatisticalFields(this._rawData.name))&&void 0!==t?t:[]);return this._seriesField&&AN(e,[{key:this._seriesField,operations:["values"]}]),e.filter((t=>t.key!==xK&&t.key!==SK&&t.key!==bK&&t.key!==_K))},target:"latest"}},!1),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform)}_statisticViewData(){hq(this._dataSet,"dimensionStatistics",gQ);const t=`${IN}_series_${this.id}_viewDataStatic`;this._viewDataStatistics=new go(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fieldFollowSource:t=>this._viewDataFilter.transformsArr.length<=1,sourceStatistics:()=>this._rawDataStatistics.latestData,fields:()=>{const t=this.getStatisticFields();return this._seriesField&&AN(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),(this._stack||this._stackValue)&&this.createdStackData()}createStatisticalData(t,e,i){hq(this._dataSet,"dimensionStatistics",gQ);const n=new go(this._dataSet,{name:t});return n.parse([e],{type:"dataview"}),n.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const n=AN(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&AN(n,[{key:this._seriesField,operations:["values"]}]),n},target:"latest"}},!1),n}createdStackData(){var t,e;const i=null!==(e=null===(t=this._rawData)||void 0===t?void 0:t.name)&&void 0!==e?e:`${IN}_series_${this.id}_viewStackData`;this._viewStackData=new go(this._dataSet),this._viewStackData.parse([this.getViewDataFilter()],{type:"dataview"}),this._viewStackData.name=i,this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e,i){return e}generateDefaultDataKey(t,e,i,n){if(l(t)){if(!1===this._spec.animation){const t=this._noAnimationDataKey(e,i,n);if(void 0!==t)return t}const{keyMap:t}=n,s=this._getSeriesDataKey(e);return void 0===t.get(s)?t.set(s,0):t.set(s,t.get(s)+1),`${s}_${t.get(s)}`}return g(t)?e[t]:f(t)&&t.every((t=>g(t)))?t.map((t=>e[t])).join("-"):o(t)?t(e,i):void this._option.onError(`invalid dataKey: ${t}`)}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this.event.emit(cK.rawDataUpdate,{model:this})}rawDataStatisticsUpdate(t){this.event.emit(cK.rawDataStatisticsUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(cK.viewDataFilterOver,{model:this})}viewDataUpdate(t){this.event.emit(cK.viewDataUpdate,{model:this}),this._data.updateData(),this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(cK.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||l(e)?null:t[e]}getDatumPositionValues(t,e){return!t||l(e)?[]:g(e)?[t[e]]:e.map((e=>t[e]))}initRootMark(){var t,e;this._rootMark=this._createMark({type:Hh.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.setZIndex(this.layoutZIndex)}_initExtensionMark(){var t;this._spec.extensionMark&&(null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)})))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${i}_${n}`},{markSpec:t,parent:e,dataView:!1});if(r)if("group"===t.type)i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}));else if(!(e||l(t.dataId)&&l(t.dataIndex))){const e=this._option.getSeriesData(t.id,t.dataIndex);e===this._rawData?r.setDataView(this.getViewData(),this.getViewDataProductId()):r.setDataView(e)}}_updateExtensionMarkSpec(t){var e;null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{var n;const s=this._marks.getMarkWithInfo({name:`${IN}_series_${this.id}_extensionMark_${i}`});t&&z(null===(n=t.extensionMark)||void 0===n?void 0:n[i],e)||(this.initMarkStyleWithSpec(s,e),s.updateStaticEncode(),s.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}initTrigger(){const t={hover:this._spec.hover,select:this._spec.select},e=Object.assign(Object.assign({},this._option),{model:this,interaction:this._region.interaction});this._trigger=new rQ(t,e)}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:vK;this.getMarksWithoutRoot().forEach((t=>{const n={},s={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(n[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{s[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:mK,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][i]]:!0===n[t[i]]});const a={};Object.keys(s).forEach((e=>{a[e]=n=>{var s,a;let o;if(Array.isArray(n)){if(0===n.length)return;o=null===(s=r[n[0][i]])||void 0===s?void 0:s[e]}return o=null===(a=r[n[i]])||void 0===a?void 0:a[e],o||t.getAttribute(e,n)}})),this.setMarkStyle(t,a,mK)}))}afterInitMark(){var t,e,i;this.event.emit(cK.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField);let n=null!==(t=this._spec.animationThreshold)&&void 0!==t?t:Number.MAX_SAFE_INTEGER;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",yK.Base_Series);const s=t.getProgressiveConfig();s&&(s.large&&s.largeThreshold&&(n=Math.min(n,s.largeThreshold)),s.progressiveThreshold&&(n=Math.min(n,s.progressiveThreshold)))})),(null===(i=null===(e=this._rawData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.length)>=n&&(this._spec.animation=!1)}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i,n;this._trigger.init(),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)),null===(n=this._rawDataStatistics)||void 0===n||n.target.addListener("change",this.rawDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this._trigger.release()}initTooltip(){this._tooltipHelper=new uQ(this)}updateSpec(t){var e,i;const n=this._spec,s=super.updateSpec(t);t.type!==this.type&&(s.reMake=!0);const{invalidType:r}=this._originalSpec;return t.invalidType!==r&&(s.reMake=!0),(V(n.extensionMark).length!==V(this._spec.extensionMark).length||(null===(e=n.extensionMark)||void 0===e?void 0:e.some(((t,e)=>t.type!==this._spec.extensionMark[e].type||t.id!==this._spec.extensionMark[e].id))))&&(s.reMake=!0),s.reMake||(this._marks.getMarks().some((t=>{var e,i;return(null===(e=n[t.name])||void 0===e?void 0:e.visible)!==(null===(i=this._spec[t.name])||void 0===i?void 0:i.visible)}))&&(s.reCompile=!0),(null===(i=n.extensionMark)||void 0===i?void 0:i.some(((t,e)=>t.visible!==this._spec.extensionMark[e].visible)))&&(s.reCompile=!0)),s}reInit(t,e){super.reInit(t),this.initMarkStyle(),this.getMarksWithoutRoot().forEach((t=>{e&&z(e[t.name],this._spec[t.name])||(this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name]),t.updateStaticEncode(),t.updateLayoutState(!0))})),this._updateExtensionMarkSpec(e)}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t;super.release(),this._viewDataMap.clear(),null===(t=this._data)||void 0===t||t.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}onLayoutEnd(t){const e=this.getRegion();this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}getSeriesKeys(){var t,e,i;return this._seriesField?null!==(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values)&&void 0!==i?i:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,n;return null!==(n=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==n?n:null}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this._rawDataStatistics.latestData[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:vK,this.getSeriesKeys())}getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),n=dh(this._option.getTheme().colorScheme,this.type);return null===(e=(t=(new mh).domain(i)).range)||void 0===e?void 0:e.call(t,n)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this._viewDataStatistics)||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:vK}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){var e;const i=this._option.getTheme();t?super._initTheme(t):super._initTheme(null!==(e=i.series[this.type])&&void 0!==e?e:{}),this._mergeThemeToSpec()}_createMark(t,e={}){var i,n,s,r;const{key:o,groupKey:c,skipBeforeLayouted:d,themeSpec:u={},markSpec:p,dataView:g,dataProductId:f,parent:v,isSeriesMark:m,dataStatistics:y,depend:_,label:b,progressive:x,support3d:S=this._spec.support3d||!!this._spec.zField,morph:w=!1}=e,A=super._createMark(t,{key:null!=o?o:this._getDataIdKey(),support3d:S,dataStatistics:null!=y?y:this._rawDataStatistics,attributeContext:this._markAttributeContext});if(h(A)){this._marks.addMark(A,{name:t.name}),m&&(this._seriesMark=A),l(v)?null===(i=this._rootMark)||void 0===i||i.addMark(A):!1!==v&&v.addMark(A),l(g)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==g&&A.setDataView(g,f),a(d)&&A.setSkipBeforeLayouted(d),h(_)&&A.setDepend(...V(_)),h(b)&&A.setLabelSpec(b);const o=this.getSpec()||{};A.setMorph(w),A.setMorphKey((null===(n=o.morph)||void 0===n?void 0:n.morphKey)||`${this._specIndex}`),A.setMorphElementKey(null!==(r=null===(s=o.morph)||void 0===s?void 0:s.morphElementKey)&&void 0!==r?r:e.defaultMorphElementKey),l(x)||A.setProgressiveConfig(x),l(c)||A.setGroupKey(c),this.initMarkStyleWithSpec(A,Lh({},u,p||o[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:fK}_getSeriesDataKey(t){let e="";if(!t)return e;return e=this.getDimensionField().map((e=>t[e])).join("_"),this.getSeriesField()&&(e+=`_${t[this.getSeriesField()]}`),e}addViewDataFilter(t){var e;null===(e=this._viewDataFilter)||void 0===e||e.transform(t,!1)}reFilterViewData(){var t;null===(t=this._viewDataFilter)||void 0===t||t.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.compileSignal(),this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==bK&&t!==SK&&t!==_K&&t!==xK||(t=this.getStackValueField()),null!==(e=MN(this.getRawData(),t))&&void 0!==e?e:t}getMarkInfoList(){var t;const e=super.getMarkInfoList();return e.length?e:Object.values(null!==(t=mc[this.type])&&void 0!==t?t:{})}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}}function AQ(t,e,i){const n=t.getScale(0),s="isInverse"in t&&t.isInverse();ol(n.type)?i.sort(((t,i)=>(t[e]-i[e])*(s?-1:1))):i.sort(((t,i)=>(n._index.get(t[e])-n._index.get(i[e]))*(s?-1:1)))}wQ.mark=Nh;class kQ extends wQ{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction=HK.vertical,this._sortDataByAxis=!1}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=V(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=V(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&V(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(){var t,e,i;const n=[];return(null===(t=this.getXAxisHelper())||void 0===t?void 0:t.getScale)&&(this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX).forEach((t=>{const e={key:t,operations:[]};ol(this.getXAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),(null===(e=this.getYAxisHelper())||void 0===e?void 0:e.getScale)&&(this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY).forEach((t=>{const e={key:t,operations:[]};ol(this.getYAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this._fieldZ&&(null===(i=this.getZAxisHelper())||void 0===i?void 0:i.getScale)&&this._fieldZ.forEach((t=>{const e={key:t,operations:[]};ol(this.getZAxisHelper().getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],n.push(e)})),this.getStack()&&n.push({key:this.getStackValueField(),operations:["allValid"]}),n}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValueField(){return this.direction===HK.vertical?V(this._spec.yField)[0]:V(this._spec.xField)[0]}setValueFieldToStack(){this.direction===HK.vertical?(this.setFieldY(bK),this.setFieldY2(_K)):(this.setFieldX(bK),this.setFieldX2(_K))}setValueFieldToPercent(){this.direction===HK.vertical?(this.setFieldY(SK),this.setFieldY2(xK)):(this.setFieldX(SK),this.setFieldX2(xK))}setValueFieldToStackOffsetSilhouette(){this.direction===HK.vertical?(this.setFieldY(AK),this.setFieldY2(wK)):(this.setFieldX(AK),this.setFieldX2(wK))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}updateSpec(t){const e=this._originalSpec,{xField:i,yField:n}=e,s=super.updateSpec(t);return vo(t.xField,i)&&vo(t.yField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),h(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._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent(),this._stackOffsetSilhouette&&this.setValueFieldToStackOffsetSilhouette(),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t){return t?{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,n;return null!==(n=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,n;return null!==(n=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==n?n: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(V(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}dataToPositionX(t){if(!this._xAxisHelper)return Number.NaN;const e=this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._fieldX;return e&&0!==e.length?this.valueToPositionX(this._xAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}dataToPositionY(t){if(!this._yAxisHelper)return Number.NaN;const e=this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._fieldY;return e&&0!==e.length?this.valueToPositionY(this._yAxisHelper.isContinuous?this.getDatumPositionValue(t,e[0]):this.getDatumPositionValues(t,e),t):null}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){var e,i;return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):null===(i=(e=this._xAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[0]:Number.NaN}dataToPositionY1(t){var e,i;return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):null===(i=(e=this._yAxisHelper).getScale)||void 0===i?void 0:i.call(e,0).range()[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._trigger.setStateKeys([...this._fieldX,...this._fieldY]),this._buildScaleConfig()}getDimensionField(){return this._direction===HK.vertical?this.fieldX:this.fieldY}getMeasureField(){var t,e;return this._direction===HK.vertical?V(null!==(t=this._spec.yField)&&void 0!==t?t:this.fieldY):V(null!==(e=this._spec.xField)&&void 0!==e?e:this.fieldX)}viewDataUpdate(t){super.viewDataUpdate(t),this.sortDataByAxis&&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)&&AQ(this._direction===HK.horizontal?this._yAxisHelper:this._xAxisHelper,this._direction===HK.horizontal?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData)}}class MQ extends NZ{setStyle(t,e="normal",i=0,n=this.stateStyle){if(l(t))return;void 0===n[e]&&(n[e]={});const s=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let h=!1;Object.keys(t).forEach((c=>{const d=t[c];if(l(d)||s.includes(c))return;a&&r.includes(c)&&(ll(null==d?void 0:d.type)||(null==d?void 0:d.scale)||o(d))&&(h=!0);let u=this._styleConvert(d);a&&"angle"===c&&(u=this.convertAngleToRadian(u)),this.setAttribute(c,u,e,i,n)})),h&&this.setAttribute("enableSegments",!0,e,i,n)}}class CQ extends MQ{constructor(){super(...arguments),this.type=CQ.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)===Fh.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}CQ.type=Hh.line;class TQ extends MQ{constructor(){super(...arguments),this.type=TQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TQ.type=Hh.area;class EQ extends NZ{constructor(){super(...arguments),this.type=EQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0})}}EQ.type=Hh.text;class PQ extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:zK.circle,fill:void 0,lineWidth:0})}}class RQ extends PQ{constructor(){super(...arguments),this.type=RQ.type}}RQ.type=Hh.symbol;class OQ extends uQ{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var n,s,r,a;for(const i of V(e)){let e=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),h(e))return e}return i}}}pZ.useMark([CQ,TQ,EQ,RQ]);class BQ extends kQ{constructor(){super(...arguments),this.type=Fh.area,this._stack=!0,this._sortDataByAxis=!1}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,c,d;super.setAttrFromSpec();const u=!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),p=!1!==(null===(n=this._spec.line)||void 0===n?void 0:n.visible)&&!1!==(null===(r=null===(s=this._spec.line)||void 0===s?void 0:s.style)||void 0===r?void 0:r.visible),g=null!==(a=this._spec.area)&&void 0!==a?a:{},f=null!==(o=this._spec.line)&&void 0!==o?o:{};g.interactive=g.interactive||f.interactive,g.support3d=g.support3d||f.support3d,g.zIndex=h(g.zIndex)||h(f.zIndex)?Math.max(null!==(l=g.zIndex)&&void 0!==l?l:0,null!==(c=f.zIndex)&&void 0!==c?c:0):void 0,g.style&&delete g.style.stroke,g.state&&Object.keys(g.state).forEach((t=>{"style"in g.state[t]?delete g.state[t].style.stroke:delete g.state[t].stroke}));let v=g,m=f;("line"===(null!==(d=this._spec.seriesMark)&&void 0!==d?d:"area")||p&&!u)&&(v=f,m=g),g.style=Lh({},m.style,v.style),g.state=Lh({},m.state,v.state),u||(g.style.fill=!1),p||(g.style.stroke=!1),g.visible=!(!u&&!p)}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this._areaMark=this._createMark(BQ.mark.area,{groupKey:this._seriesField,defaultMorphElementKey:this.getDimensionField()[0],progressive:s,isSeriesMark:r&&"point"!==a}),this.initSymbolMark(s,"point"===a)}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),y1:t=>{var e,i;return bh(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",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return bh(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),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:this.getColorAttribute()},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))),this.initLineMarkStyle(this._direction,r),this.initSymbolMarkStyle(),this.initLabelMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark&&this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._areaMark&&this._areaMark.setAnimationConfig(qJ($J.area(i,n),ZJ(jh.area,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}initTooltip(){this._tooltipHelper=new OQ(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}getDefaultShapeType(){return"square"}}BQ.type=Fh.area,BQ.mark=Xh,N(BQ,iQ);class IQ{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,n)=>{Eo(i.domain)&&i.domain.forEach((n=>{n.dataId===t&&n.fields.forEach((t=>{AN(e,[{key:t,operations:ol(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,n)=>{const s=this.getScale(n);i.forEach((i=>{var n;(null===(n=i.dataStatistics)||void 0===n?void 0:n.rawData[0].name)===t&&i.field&&AN(e,[{key:i.field,operations:ol(s.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?_h("colorOrdinal"):_h(t.type)),e?(f(t.range)&&e.range(t.range),f(t.domain)&&(Eo(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const n=this._createFromSpec(t);n&&(e.set(t.id,n),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(z(t,this._spec))return e;e.change=!0;for(let i=0;it.id===n.id));if(!r.id)return e.reMake=!0,e;if(r.type!==n.type)return e.reMake=!0,e;n.range&&!z(n.range,s.range())&&(s.range(n.range),e.reRender=!0),Eo(n.domain)?e.reRender=!0:z(n.domain,s.domain())||(s.domain(n.domain),e.reRender=!0),this._scaleSpecMap.set(n.id,n)}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)}_getStatistics(t){const e=this._chart.getAllSeries();for(let i=0;i{const n=this._scaleMap.get(i);if(!n)return;if(!Eo(e.domain))return e.domain&&0!==e.domain.length||n.domain(t),void this._updateMarkScale(i,n,[...n.domain()]);let s;s=ol(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getStatistics(t.dataId);i&&t.fields.forEach((t=>{ol(e.type)?(l(s[0])?s[0]=i.latestData[t].min:s[0]=Math.min(i.latestData[t].min,s[0]),l(s[1])?s[1]=i.latestData[t].max:s[1]=Math.max(i.latestData[t].max,s[1])):i.latestData[t].values.forEach((t=>{s.add(t)}))}))}));const r=s;ol(e.type)||(s=Array.from(s)),n.domain(s),this._updateMarkScale(i,n,r)}))}_updateMarkScale(t,e,i){const n=this._markAttributeScaleMap.get(t);n&&0!==n.length&&n.forEach((t=>{if(t.field&&t.markScale&&t.markScale!==e){if(!l(t.changeDomain)&&"none"!==t.changeDomain&&t.dataStatistics&&t.dataStatistics.latestData[t.field])return"expand"===t.changeDomain?(ol(e.type)?(i[0]=Math.min(i[0],t.dataStatistics.latestData[t.field].min),i[1]=Math.max(i[1],t.dataStatistics.latestData[t.field].max)):(t.dataStatistics.latestData[t.field].values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(ol(e.type)?t.markScale.domain([t.dataStatistics.latestData[t.field].min,t.dataStatistics.latestData[t.field].max]):t.markScale.domain(t.dataStatistics.latestData[t.field].values)));ol(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let n=this._markAttributeScaleMap.get(t.scale);n||(n=[],this._markAttributeScaleMap.set(t.scale,n));let s=i;return(l(t.field)||!l(t.changeDomain)&&"none"!==t.changeDomain&&!l(e))&&(s=i.clone()),n.push(Object.assign(Object.assign({},t),{dataStatistics:e,markScale:s})),s}}class DQ{constructor(t){this.stackRegion=({model:t})=>{const e={nodes:{}};t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackGroup(i,e,n)}));for(const t in e.nodes)this.stack(e.nodes[t]);for(const t in e.nodes)this.stackOffsetSilhouette(e.nodes[t]);t.getSeries().forEach((t=>{const i=t.getStackData(),n=t.getStackValueField();i&&n&&this.stackTotal(e,n)}))},this._chart=t}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(cK.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}stackTotal(t,e){if("values"in t&&t.values.length){const i=Zo(t.values,e),n=qo(t.values,SK);t.values.forEach((t=>{t[kK]=i,t[MK]=n,delete t[CK]}));const s=t.values.reduce(((t,e)=>e[bK]>t[bK]?e:t));s[CK]=!0}else for(const i in t.nodes)this.stackTotal(t.nodes[i],e)}stackOffsetSilhouette(t){if(!t.values.length)return;const e=t.values[t.values.length-1][bK]/2;for(let i=0;i0){let e=0,i=0,n=1,s=0;t.values.forEach((t=>{s=t[bK],s>=0?(t[_K]=e,e+=t[bK],t[bK]=e):(t[_K]=i,i+=t[bK],t[bK]=i)})),t.values.forEach((t=>{s=t[bK];const r=s>=0?e:i;n=s>=0?1:-1,t[xK]=0===r?0:Math.min(1,t[_K]/r)*n,t[SK]=0===r?0:Math.min(1,t[bK]/r)*n}))}for(const e in t.nodes)this.stack(t.nodes[e])}stackGroup(t,e,i){if("values"in t)return t.values.forEach((t=>t[bK]=function(t){if(_(t))return t;const e=+t;return _(e)?e:0}(t[i]))),void e.values.push(...t.values);for(const n in t.nodes)!e.nodes[n]&&(e.nodes[n]={values:[],nodes:{}}),this.stackGroup(t.nodes[n],e.nodes[n],i)}}class LQ extends vZ{getSpec(){return this._spec}setSpec(t){this.transformSpec(t),this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getEvent(){return this._event}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var n;return this._layoutTag=t,(null===(n=this.getCompiler())||void 0===n?void 0:n.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().reRenderAsync(e)),this._layoutTag}constructor(t,e){var i,n;super(e),this.type="chart",this.id=Co(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:DN,height:LN},this._viewRect={width:DN,height:LN},this._viewBox={x1:0,y1:0,x2:DN,y2:LN},this._idMap=new Map,this._layoutTag=!0,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)=>V(t).some((t=>h(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===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>e.specKey===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this._theme=e.getTheme(),this._paddingSpec=Ch(null!==(i=t.padding)&&void 0!==i?i:null===(n=this._theme)||void 0===n?void 0:n.padding),this._event=new rq(e.eventDispatcher,e.mode),this._dataSet=e.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:this._option.onError}),this._stack=new DQ(this),this._spec=t}created(){this.transformSpec(this._spec),this.createGlobalScale(),this.createBackground(this._spec.background),this.createLayout(),this.createRegion(this._spec.region),this.createSeries(this._spec.series),this.createComponent(this._spec)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),P(t,"tooltip")||(t.tooltip={})}init(t={}){this.initRegion(),this.initSeries(),this.initComponent(),this.initEvent(),this._stack.init(),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){const i={width:t,height:e};this._canvasRect=i,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0)}updateViewBox(t,e){this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}createBackground(t){t&&"object"==typeof t&&(this._backgroundMark=BN.createMark(Hh.group,"chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(function(t){if(!t)return null;if("string"==typeof t)return{fill:t,fillOpacity:1};if("object"!=typeof t)return null;const{x:e,y:i,width:n,height:s,x1:r,y1:a,image:o}=t,l=vn(t,["x","y","width","height","x1","y1","image"]);return l.background=o,l}(t)),this._backgroundMark.setStyle({x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1}))}createRegion(t){t&&t.forEach(((t,e)=>{const i=BN.createRegion("region",t,Object.assign(Object.assign({},this._modelOption),{specIndex:e,specKey:"region"}));i&&(i.created(),this._regions.push(i))}))}initRegion(){this._regions.forEach((t=>t.init({})))}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}):t.data=this.getSeriesData(t.dataId,t.dataIndex),!1===this._option.animation&&(t.animation=!1),h(t.regionId)?i=this.getRegionsInUserId(t.regionId):h(t.regionIndex)&&(i=this.getRegionsInIndex([t.regionIndex])[0]),i||(i=this._regions[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale,getSeriesData:this.getSeriesData.bind(this)}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}initSeries(){this._series.forEach((t=>t.init({})))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getTheme:()=>this._theme,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey}));i&&V(i).forEach((t=>{t.created(),this._components.push(t)}))}createComponent(t){const e=BN.getComponents();let i,n;const s=[];for(let t=0;t{this._createComponent(e,t)}))}initComponent(){this._components.forEach((t=>t.init({dataSet:this._dataSet})))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let i=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(i=!0);const n=new(BN.getLayout(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:i?"layout3d":"base"))(this._spec.layout,{onError:this._option.onError});this._layoutFunc=n.layoutItems.bind(n)}}layout(t){var e,i,n,s;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(cK.layoutStart,{chart:this}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(cK.layoutEnd,{chart:this})}null===(s=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterLayoutWithSceneGraph)||void 0===s||s.call(n)}onLayoutStart(t){this.getLayoutElements().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getLayoutElements().forEach((e=>e.onLayoutEnd(t)))}onEvaluateEnd(t){this.getLayoutElements().forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return[...this._components,...this._regions,...this._series]}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof wZ)return e}getModelByUserId(t){const e=this._series.find((e=>e.userId===t));if(e)return e;const i=this._regions.find((e=>e.userId===t));if(i)return i;const n=this._components.find((e=>e.userId===t));return n||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof NZ))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof NZ)return e}updateParseData(t,e,i){const n=this._dataSet.getDataView(t);n&&n.updateRawData(e)}updateData(t,e,i=!0,n){const s=this._dataSet.getDataView(t);s&&s.parseNewData(e,n),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){const i=[];V(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&(i.push({d:t,dv:e}),e.markRunning())})),i.forEach((({d:t,dv:e})=>{e.setFields(t.fields),e.parseNewData(t.values,t.parser)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=uZ(this._spec,this._option)),this._canvasRect}getSeriesData(t,e){if(!this._spec.data)return this._option.onError("no data in spec!"),null;if("string"==typeof t){const e=this._spec.data.filter((e=>e.name===t));return e[0]?e[0]:(this._option.onError(`no data matches dataId ${t}!`),null)}return"number"==typeof e?this._spec.data[e]?this._spec.data[e]:(this._option.onError(`no data matches dataIndex ${e}!`),null):this._spec.data[0]}_transformSpecScale(){var t,e,i;const n=null!==(t=this._spec.scales)&&void 0!==t?t:[];let s=n.find((t=>"color"===t.id));if(!s&&(s={type:"ordinal",id:"color",domain:null,range:null},n.push(s),this._spec.color)){const t=this._spec.color;if(f(t))s.range=t.map((t=>{var e;return gh(t,null===(e=this._theme)||void 0===e?void 0:e.colorScheme)}));else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(s.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(s.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(s.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(s.specified=e.specified)}}return(null===(e=s.range)||void 0===e?void 0:e.length)||(s.range=dh(null===(i=this._theme)||void 0===i?void 0:i.colorScheme),s.rangeTheme=!0),n}createGlobalScale(){this._globalScale=new IQ(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){this._mergeUpdateResult(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){var t;const e=this._globalScale.getScaleSpec("color");e.rangeTheme&&(e.range=dh(null===(t=this._theme)||void 0===t?void 0:t.colorScheme),this._globalScale.getScale("color").range(e.range))}updateSpec(t,e){const i={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,e),t.type!==this.type)return i.reMake=!0,i;this.transformSpec(t);const n=Object.keys(this._spec).sort(),s=Object.keys(t).sort();return JSON.stringify(n)!==JSON.stringify(s)?(i.reMake=!0,i):(this._spec=t,this.updateGlobalScale(i),i.reMake?i:(this.updateRegionSpec(i),i.reMake?i:(this.updateComponentSpec(i),i.reMake?i:(this.updateSeriesSpec(i),i.reMake?i:(this.updateDataSpec(i),i.reMake||this.updateGlobalScaleDomain(),i)))))}updateDataSpec(t){this._spec.data&&V(this._spec.data).forEach(((e,i)=>{const n=this._dataSet.getDataView(e.id);n?(e.fields&&n.setFields(e.fields),e.values?n.parseNewData(e.values,e.parser):e.latestData||n.updateRawData([])):t.reMakeData=!0}))}updateRegionSpec(t){var e;(null===(e=this._spec)||void 0===e?void 0:e.region)&&(this._spec.region.length===this._regions.length?this._regions.forEach((e=>{this._mergeUpdateResult(t,e.updateSpec(this._spec.region[e.getSpecIndex()])),e.reInit()})):t.reMake=!0)}updateComponentSpec(t){const e={};this._components.forEach((i=>{var n;const s=null!==(n=this._spec[i.specKey])&&void 0!==n?n:{};f(s)?(e[i.specKey]=e[i.specKey]||{specCount:s.length,componentCount:0},e[i.specKey].componentCount++,this._mergeUpdateResult(t,i.updateSpec(s[i.getSpecIndex()],s))):this._mergeUpdateResult(t,i.updateSpec(s)),i.reInit()}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const n=e[i];n.componentCount!==n.specCount&&(t.reMake=!0)}}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{var i;const n=this._spec.series[e.getSpecIndex()];if(t.reMakeData){let t;t=n.data?n.data.values:null===(i=this.getSeriesData(n.dataId,n.dataIndex))||void 0===i?void 0:i.latestData,e.updateRawData(t)}const s=e.getSpec();this._mergeUpdateResult(t,e.updateSpec(n)),e.reInit(null,s)})):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}isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i;return{data:null===(e=t.data)||void 0===e?void 0:e[0],dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:t.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:this._theme.animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField}}_mergeUpdateResult(t,e){t.change=t.change||e.change,t.reCompile=t.reCompile||e.reCompile,t.reMake=t.reMake||e.reMake,t.reRender=t.reRender||e.reRender,t.reSize=t.reSize||e.reSize}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:n=0,x2:s,y2:r}=t;e={width:s-i,height:r-n}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=Mh(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(cK.layoutRectUpdate,{})}getCurrentTheme(){return this._theme}setCurrentTheme(t){this._theme=t,this.setLayoutTag(!0),this.transformSpec(this._spec),this.updateGlobalScaleTheme(),this.setRegionTheme(),this.setComponentTheme(t),this.setSeriesTheme(t)}setRegionTheme(){this._regions.forEach((t=>{t.reInit()}))}setComponentTheme(t){this._components.forEach((e=>{e.setCurrentTheme(t.series[e.type],!0)}))}setSeriesTheme(t){this._series.forEach((e=>mn(this,void 0,void 0,(function*(){yield e.setCurrentTheme(t.series[e.type],!0)}))))}clear(){this.getLayoutElements().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile(),null===(t=this._backgroundMark.getProduct())||void 0===t||t.configure({context:{model:this}}).layout((()=>{})))}compileRegions(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===n||n.call(i)}compileSeries(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===n||n.call(i)}compileComponents(){var t,e,i,n;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(n=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===n||n.call(i)}release(){super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.checkUpdate(e,null,null),this.layout({group:e,srView:t})}checkUpdate(t,e,i){var n,s;(null===(n=t.context)||void 0===n?void 0:n.model)&&(i=t,e=t.context.model),e&&t.isUpdated?null===(s=e.bindSceneNode)||void 0===s||s.call(e,i.elements[0]):"group"===t.markType&&t.children.forEach((t=>{this.checkUpdate(t,e,i)}))}updateState(t,e){const i=this.getAllSeries();for(const n in t){if(C(t[n]))continue;const s=t[n];let r={stateValue:n};r=o(s.filter)?Object.assign({filter:s.filter},r):Object.assign(Object.assign({},s.filter),r),s.level&&(r.level=s.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[n]&&(e&&!e(t,i,n)||(i.state.changeStateInfo(r),i.updateMarkState(n)))}))}))}}setSelected(t,e,i){this._setStateInDatum(rZ.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(rZ.STATE_HOVER,!0,t,e,i)}initEvent(){[cK.dataZoomChange,cK.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{if(!t.filterData)return;this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(NV.AFTER_MARK_RENDER_END,e)};this._event.on(NV.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,n,s){const r=(i=i?V(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(s).forEach((s=>{i?(s.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!n||o(n)&&n(e,a))){const e=a.getProduct().isCollectionMark(),n=a.getProduct().elements;let o=n;if(e)o=n.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((n=>t[n]==e[i][n]))))}));else if(i.length>1){const t=[...i];o=n.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),n=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return n>=0&&(t.splice(n,1),!0)}))}else{const t=n.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{s.interaction.addEventElement(t,e)}))}}))})),e&&s.interaction.reverseEventElement(t)):s.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,n,s,r;let a=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:n,event:s}=i;if(n===nq.dimensionHover||n===nq.dimensionClick){const i=s.dispatch(t,e);(null==i?void 0:i.length)&&(a=i)}}));const o=l(t)||!a||a.every((t=>hl(t.axis.getScale().type)&&l(t.index)));if(!1!==e.tooltip){const t=this._components.find((t=>t.type===bn.tooltip));if(null==t?void 0:t.getVisible())if(o)null===(n=(i=t).hideTooltip)||void 0===n||n.call(i);else{const i={};a.forEach((t=>{const{axis:e,value:n,data:s}=t,r="left"===e.getOrient()||"right"===e.getOrient();s.forEach((t=>{r?i[t.series.fieldY[0]]=n:i[t.series.fieldX[0]]=n}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this._components.find((t=>t.type===bn.cartesianCrosshair));t&&t.clearAxisValue&&t.setAxisValue&&(o?(null===(s=t.clearAxisValue)||void 0===s||s.call(t),null===(r=t.hide)||void 0===r||r.call(t)):a.forEach((e=>{const{axis:i,value:n}=e;t.clearAxisValue(),t.setAxisValue(n,i),t.layoutByValue()})))}}}class FQ extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}needAxes(){return!0}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.needAxes()&&(t.axes||(t.axes=[]),t.region.forEach((e=>{const i={x:!1,y:!1,z:!1};t.axes.forEach((t=>{const{orient:e}=t;"top"!==e&&"bottom"!==e||(i.x=!0),"left"!==e&&"right"!==e||(i.y=!0),"z"===e&&(i.z=!0)})),i.x||t.axes.push({orient:"bottom"}),i.y||t.axes.push({orient:"left"}),t.zField&&!i.z&&t.axes.push({orient:"z"})})));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]}}var jQ;!function(t){t.common="common",t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.histogram="histogram",t.histogram3d="histogram3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.sequence="sequence",t.circularProgress="circularProgress",t.linearProgress="linearProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.waterfall="waterfall",t.boxPlot="boxPlot",t.gauge="gauge",t.sankey="sankey",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.heatmap="heatmap"}(jQ||(jQ={})),pZ.useSeries([BQ]);class zQ extends FQ{constructor(){super(...arguments),this.type=jQ.area,this.seriesType=Fh.area}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}zQ.type=jQ.area,zQ.view="singleDefault";class HQ extends NZ{constructor(){super(...arguments),this.type=HQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}HQ.type=Hh.rect,pZ.useMark([HQ,EQ]);class NQ extends kQ{constructor(){super(...arguments),this.type=Fh.bar,this._barMarkName=jh.bar,this._barMarkType=Hh.rect,this._stack=!0,this._bandPosition=0}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._rectMark=this._createMark(Object.assign(Object.assign({},NQ.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t})}initMarkStyle(){var t;const e=this._rectMark;e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}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()}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initLinearRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0);this.setMarkStyle(this._rectMark,{x:t=>bh(this.dataToPositionX(t),s),x1:t=>bh(this.dataToPositionX1(t),s),y:t=>bh(this.dataToPositionY(t),r),y1:t=>bh(this.dataToPositionY1(t),r)},"normal",yK.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.bar(i,n),ZJ(this._barMarkName,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}_getBarWidth(t){var e,i;const n=void 0!==this._spec.barWidth,s=null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:6;if(n)return Eh(this._spec.barWidth,s);const r=void 0!==this._spec.barMinWidth,a=void 0!==this._spec.barMaxWidth;let o=s;return r&&(o=Math.max(o,Eh(this._spec.barMinWidth,s))),a&&(o=Math.min(o,Eh(this._spec.barMaxWidth,s))),o}_getPosition(t,e){var i,n,s,r,a,o,l,c,d;let u,p,g;t===HK.horizontal?(u=this.getYAxisHelper(),p="height",g=this.dataToPositionY.bind(this)):(u=this.getXAxisHelper(),p="width",g=this.dataToPositionX.bind(this));const f=u.getScale(0),v=this._rectMark.getAttribute(p,e),m=null!==(n=null===(i=u.getBandwidth)||void 0===i?void 0:i.call(u,this._groups?this._groups.fields.length-1:0))&&void 0!==n?n:6;if((null===(r=null===(s=this._groups)||void 0===s?void 0:s.fields)||void 0===r?void 0:r.length)>1&&h(this._spec.barGapInGroup)){const t=this._groups.fields,i=V(this._spec.barGapInGroup);let n=0,s=0;for(let r=t.length-1;r>=1;r--){const h=t[r],u=null!==(c=null===(l=null===(o=null===(a=this.getViewDataStatistics())||void 0===a?void 0:a.latestData)||void 0===o?void 0:o[h])||void 0===l?void 0:l.values)&&void 0!==c?c:[],p=u.length,g=Eh(null!==(d=i[r-1])&&void 0!==d?d:W(i),m),f=u.indexOf(e[h]);r===t.length-1?(n+=p*v+(p-1)*g,s+=f*(v+g)):(s+=f*(n+g),n+=n+(p-1)*g)}return f.scale(e[t[0]])+u.getBandwidth(0)/2-n/2+s}const y=ol(f.type||"band");return g(e)+.5*(m-v)+(y?-m/2:0)}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}getDefaultShapeType(){return"square"}}NQ.type=Fh.bar,NQ.mark=Vh,pZ.useSeries([NQ]);class VQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar,this.seriesType=Fh.bar}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}transformSpec(t){super.transformSpec(t),dZ(t)}}VQ.type=jQ.bar,VQ.view="singleDefault";class WQ extends NZ{constructor(){super(...arguments),this.type=WQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}WQ.type=Hh.rect3d,pZ.useMark([WQ,EQ]);class GQ extends NQ{constructor(){super(...arguments),this.type=Fh.bar3d,this._barMarkName=jh.bar3d,this._barMarkType=Hh.rect3d}}GQ.type=Fh.bar3d,GQ.mark=Wh,pZ.useSeries([GQ]);class UQ extends FQ{constructor(){super(...arguments),this.type=jQ.bar3d,this.seriesType=Fh.bar3d}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}UQ.type=jQ.bar3d,UQ.view="singleDefault";const YQ=`${IN}_BOX_PLOT_OUTLIER_VALUE`;var XQ;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(XQ||(XQ={}));const $Q=(t,e)=>{const i=[],{outliersField:n,dimensionField:s}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[n];f(e)||(e=[e]),i.push(...e.map((e=>{const i={[YQ]:e};return s.forEach((e=>{i[e]=t[e]})),i})))})),i};class KQ extends uQ{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return this.series.getOutliersField();if(t===XQ.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case XQ.MIN:return this.series.getMinField();case XQ.MAX:return this.series.getMaxField();case XQ.MEDIAN:return this.series.getMedianField();case XQ.Q1:return this.series.getQ1Field();case XQ.Q3:return this.series.getQ3Field();case XQ.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===XQ.OUTLIER)return e[YQ];if(t===XQ.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case XQ.MIN:return e[this.series.getMinField()];case XQ.MAX:return e[this.series.getMaxField()];case XQ.MEDIAN:return e[this.series.getMedianField()];case XQ.Q1:return e[this.series.getQ1Field()];case XQ.Q3:return e[this.series.getQ3Field()];case XQ.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.contentShapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>h(t[YQ])}getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.getContentKey(XQ.OUTLIER),value:this.getContentValue(XQ.OUTLIER),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeHollow:!1},{key:this.getContentKey(XQ.MAX),value:this.getContentValue(XQ.MAX),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q3),value:this.getContentValue(XQ.Q3),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MEDIAN),value:this.getContentValue(XQ.MEDIAN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.Q1),value:this.getContentValue(XQ.Q1),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.MIN),value:this.getContentValue(XQ.MIN),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1},{key:this.getContentKey(XQ.SERIES_FIELD),value:this.getContentValue(XQ.SERIES_FIELD),hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class qQ extends NZ{constructor(){super(...arguments),this.type=qQ.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape");"bar"===e?(pW("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(tG).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,n,s,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,n,s,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,n,s,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),YW("barBoxplotScaleIn",eG),YW("barBoxplotScaleOut",iG)):(pW("boxplot",{shaft:"rule",box:"rect",max:"rule",min:"rule",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","boxWidth","boxHeight","ruleWidth","ruleHeight"]).registerFunctionEncoder(qW).registerChannelEncoder("x",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,n,s,r)=>"horizontal"!==(null==r?void 0:r.direction)?null:{shaft:{y:e,y1:e}})).registerChannelEncoder("q1",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,n,s,r)=>"horizontal"===(null==r?void 0:r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,n,s,r)=>{var a;const o="horizontal"===(null==r?void 0:r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?a:o;return{shaft:{angle:e,anchor:l},box:{angle:e,anchor:l},max:{angle:e,anchor:l},min:{angle:e,anchor:l},median:{angle:e,anchor:l}}})).registerDefaultEncoder((()=>({max:{visible:!1},min:{visible:!1},median:{visible:!1}}))),YW("boxplotScaleIn",ZW),YW("boxplotScaleOut",JW));const i=this.getVGrammarView(),n=this.getProductId(),s="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(s,null!=t?t:i.rootMark).id(n).configureGlyph({direction:r}),this._compiledProductId=n}}qQ.type=Hh.boxPlot,pZ.useMark([qQ,RQ]);class ZQ extends kQ{constructor(){super(...arguments),this.type=Fh.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,n,s;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!==(n=r.shaftShape)&&void 0!==n?n:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(s=r.shaftFillOpacity)&&void 0!==s?s:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(ZQ.mark.boxPlot,{isSeriesMark:!0,progressive:t}),this._outlierMark=this._createMark(ZQ.mark.outlier,{progressive:t,key:gK,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()})}initMarkStyle(){var t,e,i,n,s,r,a;const o=this._boxPlotMark;if(o){const n={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s=this._direction===HK.vertical?Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},n),{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()}}):Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},n),{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()}});this.setMarkStyle(o,s,rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(o),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(o)}const l=this._outlierMark;l&&(this.setMarkStyle(l,{fill:null!==(s=null===(n=this._outliersStyle)||void 0===n?void 0:n.fill)&&void 0!==s?s:this.getColorAttribute(),size:y(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10,symbolType:"circle"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(l),null===(a=this._tooltipHelper)||void 0===a||a.activeTriggerSet.mark.add(l))}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,n=this._direction===HK.vertical?this._yAxisHelper:this._xAxisHelper;if(i&&n){const{dataToPosition:e}=n,s=null===(t=null==n?void 0:n.getScale)||void 0===t?void 0:t.call(n,0);this.setMarkStyle(i,{min:t=>bh(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),s),q1:t=>bh(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),s),median:t=>bh(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),s),q3:t=>bh(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),s),max:t=>bh(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),s)},rZ.STATE_NORMAL,yK.Series)}const s=this._outlierMark;if(s&&n){const{dataToPosition:t}=n,i=null===(e=null==n?void 0:n.getScale)||void 0===e?void 0:e.call(n,0),r=this._direction===HK.vertical?{x:this.dataToPositionX.bind(this),y:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)}:{y:this.dataToPositionY.bind(this),x:e=>bh(t(this.getDatumPositionValues(e,YQ),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(s,r,rZ.STATE_NORMAL,yK.Series)}}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"foldOutlierData",$Q),hq(this._dataSet,"addVChartProperty",nQ);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:this._direction===HK.vertical?this._fieldX:this._fieldY,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),this._outlierDataView=new vQ(this._option,t)}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t=this._direction===HK.vertical?this._xAxisHelper:this._yAxisHelper,e=this._direction===HK.vertical?this._fieldX:this._fieldY,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t){const e=Object.assign({},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,n,s;const r=t=>{var e,i,n;const s=this._direction===HK.vertical?this._fieldX[0]:this._fieldY[0],r=null==t?void 0:t[s];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[s])||void 0===n?void 0:n.values.indexOf(r))||0};if(this._boxPlotMark){const t=this._initAnimationSpec($J.boxPlot()),e=this._initAnimationSpec(ZJ(jh.boxPlot,this._spec));this._boxPlotMark.setAnimationConfig(qJ(t,e,{dataIndex:r}))}if(this._outlierMark){const a={appear:null===(t=this._spec.animationAppear)||void 0===t?void 0:t.symbol,disappear:null===(e=this._spec.animationDisappear)||void 0===e?void 0:e.symbol,enter:null===(i=this._spec.animationEnter)||void 0===i?void 0:i.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(s=this._spec.animationUpdate)||void 0===s?void 0:s.symbol};this._outlierMark.setAnimationConfig(qJ($J.symbol(),a,{dataIndex:r}))}}initTooltip(){this._tooltipHelper=new KQ(this)}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"}}ZQ.type=Fh.boxPlot,ZQ.mark=oc,pZ.useSeries([ZQ]);class JQ extends FQ{constructor(){super(...arguments),this.type=jQ.boxPlot,this.seriesType=Fh.boxPlot}_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:HK.vertical,minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return n[n.direction===HK.vertical?"yField":"xField"]=i,n}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),dZ(t)}}JQ.type=jQ.boxPlot,JQ.view="singleDefault";const QQ=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const n=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!n||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(n&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):QQ(t.children,e,i)))})),e};function t0(t,e,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(n-e)/t.value;for(;++l(e,i,n,s,r)=>{!function(t,e,i,n,s,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,f,v,m,y,_,b,x,S=e.value;for(;cm&&(m=h),x=f*f*b,y=Math.max(m/x,x/v),y>_){f-=h;break}_=y}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=0,o=null!=n?n:-1,h=i;return t.forEach(((t,n)=>{var c,d;const u={flattenIndex:++o,key:r?r(t):`${null!==(c=null==s?void 0:s.key)&&void 0!==c?c:""}-${n}`,maxDepth:-1,depth:i,index:n,value:t.value,isLeaf:!0,datum:s?s.datum.concat(t):[t],parentKey:null==s?void 0:s.key};if(null===(d=t.children)||void 0===d?void 0:d.length){u.children=[],u.isLeaf=!1;const e=n0(t.children,u.children,i+1,o,u,r);u.value=l(t.value)?e.sum:Math.max(e.sum,u.value),o=e.flattenIndex,h=Math.max(e.maxDepth,h)}else u.isLeaf=!0,u.value=l(t.value)?0:t.value;a+=Math.abs(u.value),e.push(u)})),{sum:a,maxDepth:h,flattenIndex:o}},s0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;s=e(t,n,i,s),(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=s0(t.children,e,t,s))})),n},r0=(t,e,i,n)=>{let s=n;return t.forEach(((t,n)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(s=r0(t.children,e,t,s)),s=e(t,n,i,s)})),s},a0={binary:function(t,e,i,n,s){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=n,e.y0=s,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-s){const r=i?(n*f+a*g)/i:a;h(t,u,g,n,s,r,o),h(u,e,f,r,s,a,o)}else{const r=i?(s*f+o*g)/i:o;h(t,u,g,n,s,a,r),h(u,e,f,n,r,a,o)}};h(0,a,t.value,e,i,n,s)},dice:t0,slice:e0,sliceDice:function(t,e,i,n,s){(t.depth%2==1?e0:t0)(t,e,i,n,s)}};class o0{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const n=this._getMinAreaByDepth(t.depth);if(n>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=f(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=f(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=f(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=f(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,n=t.y0,s=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,s-=e/2,n+=e/2,r-=e/2,i>s&&(i=(i+s)/2,s=i),n>r&&(n=(n+r)/2,r=n),t.x0=i,t.x1=s,t.y0=n,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&n+en?(t.labelRect={x0:i,y0:r-e,x1:s,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:s-e,y0:n,x1:s,y1:r},s-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,s+=o/2,n-=o/2,r+=o/2),this._splitNode(t,i,n,s,r)}},this.options=Object.assign({},o0.defaultOpionts,t);const i=this.options.nodeKey,n=o(i)?i:i?Io(i):null;this._getNodeKey=n,this._splitNode="squarify"===this.options.splitType?i0(this.options.aspectRatio):null!==(e=a0[this.options.splitType])&&void 0!==e?e:a0.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const n="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)},s=[],r=n0(t,s,0,-1,null,this._getNodeKey);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:n.x0,x1:n.x1,y0:n.y0,y1:n.y1,children:s},o=n.width*n.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(y(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(y(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)}))}}o0.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const l0={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class h0{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];t0(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),l0);const n=f(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],n)return this._layoutLabel(t,a(n)?{align:"center",rotate:"radial"}:n)}))}},this.options=t?Object.assign({},h0.defaultOpionts,t):Object.assign({},h0.defaultOpionts);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Vo(this.options.center[0],t.width),n=t.y0+Vo(this.options.center[1],t.height),s=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=f(r),h=o?r.map((t=>Vo(t,s))):Vo(r,s),c=f(a),d=this.options.gapRadius,u=c?a.map((t=>Vo(t,s))):Vo(a,s),p=X(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=h[e];return l(i)?s:i})),this._parsedOutterRadius=p.map(((t,i)=>{var n;return c?u[i]:il(u[e])?s:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?h:this._parsedOutterRadius[e-1]-(f(d)?null!==(i=d[e])&&void 0!==i?i:0:d)}));else{const t=Vo(r,s),i=(u-t)/(e+1);this._parsedInnerRadius=p.map(((e,n)=>t+n*i)),this._parsedOutterRadius=p.map(((t,e)=>{var n;return this._parsedInnerRadius[e]+i-(f(d)?null!==(n=d[e])&&void 0!==n?n:0:d)}))}this._parsedCenter=[i,n],this._maxRadius=s}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 n=[],s=n0(t,n,0,-1,null,this._getNodeKey);return this._parseRadius(i,s.maxDepth),this._maxDepth=s.maxDepth,this._layout(n,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:s.sum,datum:null,children:n,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),n}_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 n=(t.startAngle+t.endAngle)/2,s=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},s,n);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=n-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*s;else{const i=n%(2*Math.PI),s=i<0?i+2*Math.PI:i;s>Math.PI/2&&s<1.5*Math.PI?(t.label.angle=s+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=s,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}h0.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const c0=4294967296;function d0(t,e){let i,n;if(g0(e,t))return[e];for(i=0;i0&&i*i>n*n+s*s}function g0(t,e){for(let i=0;i1e-6?(C+Math.sqrt(C*C-4*M*T))/(2*M):T/C);return{x:n+S+w*E,y:s+A+k*E,radius:E}}function y0(t,e,i){const n=t.x-e.x;let s,r;const a=t.y-e.y;let o,l;const h=n*n+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(s=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-s*s)),i.x=t.x-s*n-o*a,i.y=t.y-s*a+o*n):(s=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-s*s)),i.x=e.x+s*n-o*a,i.y=e.y+s*a+o*n)):(i.x=e.x+i.radius,i.y=e.y)}function _0(t,e){const i=t.radius+e.radius-1e-6,n=e.x-t.x,s=e.y-t.y;return i>0&&i*i>n*n+s*s}function b0(t){const e=t._,i=t.next._,n=e.radius+i.radius,s=(e.x*i.radius+i.x*e.radius)/n,r=(e.y*i.radius+i.y*e.radius)/n;return s*s+r*r}function x0(t){return{_:t,next:null,prev:null}}function S0(t,e){const i=(t=V(t)).length;if(!i)return 0;let n=t[0];if(n.x=0,n.y=0,1===i)return n.radius;const s=t[1];if(n.x=-s.radius,s.x=n.radius,s.y=0,2===i)return n.radius+s.radius;let r=t[2];y0(s,n,r);let a,o,l,h,c,d,u,p=x0(n),g=x0(s),f=x0(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:f(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,n,s,r,a;const l="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 h=[],c=n0(t,h,0,-1,null,this._getNodeKey);this._maxDepth=c.maxDepth;const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%c0)/c0}(),u={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:c.sum,datum:null,children:h,x:l.x0+l.width/2,y:l.y0+l.height/2};if(!1!==(null===(i=this.options)||void 0===i?void 0:i.nodeSort)){const t=o(null===(n=this.options)||void 0===n?void 0:n.nodeSort)?this.options.nodeKey:M0.defaultOpionts.nodeSort;s0([u],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(null===(s=this.options)||void 0===s?void 0:s.setRadius)s0([u],w0(this.options.setRadius)),r0([u],A0(this._getPadding,.5,d)),s0([u],k0(1,this._maxDepth));else{const t=Math.min(l.width,l.height);s0([u],w0(M0.defaultOpionts.setRadius)),r0([u],A0(Lo,1,d)),(null===(r=this.options)||void 0===r?void 0:r.padding)&&r0([u],A0(this._getPadding,u.radius/t,d)),s0([u],k0(t/(2*u.radius),this._maxDepth))}return(null===(a=this.options)||void 0===a?void 0:a.includeRoot)?[u]:h}}M0.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const C0=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;if(0===n||0===s)return t;return new M0(i).layout(t,{width:n,height:s})},T0=(t,e={})=>{if(!t)return[];const i=[];return QQ(t,i,e),i};class E0 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var P0;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(P0||(P0={}));const R0=(t,e)=>{const i=e.info(),n=e.keyField(),s=null==i?void 0:i.key;if(l(s))return t;if(i.type===P0.DrillDown){return V(CN(t,s,n,"children"))}if(i.type===P0.DrillUp){const e=TN(t,s,n,"children");if(e)return V(e)}return t};class O0{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(){}parserDragEvent(){return!0}}class B0{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return this.pointerId?this.pointerId===t.pointerId:(this.pointerId=t.pointerId,!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(){}}const I0={[t.RenderModeEnum["desktop-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["desktop-miniApp"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:O0},[t.RenderModeEnum["mobile-browser"]]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.miniApp]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0},[t.RenderModeEnum.lynx]:{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:B0}};class D0{_getTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=I0[i])||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getAllComponents().find((t=>t.type===bn.tooltip));t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;hq(t,"drillFilter",R0),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,n=i();this._getTriggerEvent("start")&&t.on(this._getTriggerEvent("start"),(t=>{var i,s,r;if(l(t.datum)||l(null===(i=t.datum)||void 0===i?void 0:i[n]))return void this.drillUp();this._hideTooltip();const a=t.datum[n],o=null!==(r=null===(s=this._drillInfo)||void 0===s?void 0:s.path)&&void 0!==r?r:[],h=((t,e,i="key",n="children")=>{const s=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return s.push(...a,o[i].toString()),!0;if(o[n]){const t=r(o[n],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),s})(e().rawData,a,n,"children");o[o.length-1]===h[h.length-1]?this.drillUp():this.drillDown(h)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!f(t)||C(t))return t;const n=t[t.length-1];return this._drillInfo={key:n,path:t,type:P0.DrillDown},e().reRunAllTransform(),i.emit(cK.drill,{value:{path:t,type:P0.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:n}=this._drillParams,s=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!f(s)||C(s))return s;const r=s.pop();return this._drillInfo={key:r,path:s,type:P0.DrillUp},i().reRunAllTransform(),n.emit(cK.drill,{value:{path:s,type:P0.DrillUp},model:this}),s}}class L0 extends NZ{constructor(t,e){super(t,e),this.type=F0.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",n,s)=>{var r;return s+(null!==(r=this._computeAttribute("radiusOffset",e,i,n))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",n,s)=>s+$o({angle:e[ZN],radius:this._computeAttribute("centerOffset",e,i,n)})[t],this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0})}}class F0 extends L0{constructor(){super(...arguments),this.type=F0.type}}F0.type=Hh.arc,pZ.useMark([F0,EQ]);class j0 extends kQ{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},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();l(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"circlePackingLayout",C0),hq(this._dataSet,"flatten",T0),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initCirclePackingMarkStyle(){l(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},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t,e;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const i=this._createMark(j0.mark.label,{isSeriesMark:!1});this._labelMark=i,this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},rZ.STATE_NORMAL,yK.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initTooltip(){this._tooltipHelper=new E0(this)}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.circlePacking({},i),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}}j0.type=Fh.circlePacking,j0.mark=fc,N(j0,D0),pZ.useSeries([j0]);class z0 extends LQ{constructor(){super(...arguments),this.type=jQ.circlePacking,this.seriesType=Fh.circlePacking}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=Fh.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}z0.type=jQ.circlePacking,z0.view="singleDefault";class H0 extends LQ{constructor(){super(...arguments),this.type=jQ.common}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}transformSpec(t){if(super.transformSpec(t),f(t.series)){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])}))}))}}}H0.type=jQ.common,H0.view="singleDefault";class N0 extends LQ{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const V0=(t,e)=>{var i,n;const s=t.map((t=>Object.assign({},t)));if(!s||0===s.length)return s;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:v=!0,range:m}=e,y=s.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),b=s.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),x=[null!==(i=null==m?void 0:m.min)&&void 0!==i?i:b,null!==(n=null==m?void 0:m.max)&&void 0!==n?n:y];return s.forEach(((t,e)=>{var i,n;const m=Number.parseFloat(t[r]),y=Number.parseFloat(null===(i=s[e-1])||void 0===i?void 0:i[r]),b=Number.parseFloat(null===(n=s[e+1])||void 0===n?void 0:n[r]),S=_(b*m)?b/m:null,w=_(m*m)?m/y:null;u&&(t[u]=y),g&&(t[g]=b),a&&(t[a]=S),o&&(t[o]=0===e?1:w),l&&(t[l]=!0===f?S:1/s.length),h&&(t[h]=m/x[1]),c&&(t[c]=e===s.length-1?v?0:t[h]:b/x[1]),d&&(t[d]=0===e?1:y/x[1]),p&&(t[p]=m)})),s},W0=(t,e)=>{var i,n;const s=null===(n=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===n?void 0:n.map((t=>Object.assign({},t)));return s&&0!==s.length?(s.shift(),s.forEach((t=>{t[e.asIsTransformLevel]=!0})),s):s},G0=`${IN}_FUNNEL_TRANSFORM_RATIO`,U0=`${IN}_FUNNEL_REACH_RATIO`,Y0=`${IN}_FUNNEL_HEIGHT_RATIO`,X0=`${IN}_FUNNEL_VALUE_RATIO`,$0=`${IN}_FUNNEL_LAST_VALUE_RATIO`,K0=`${IN}_FUNNEL_NEXT_VALUE_RATIO`,q0=`${IN}_FUNNEL_LAST_VALUE`,Z0=`${IN}_FUNNEL_CURRENT_VALUE`,J0=`${IN}_FUNNEL_NEXT_VALUE`,Q0=`${IN}_FUNNEL_TRANSFORM_LEVEL`,t1=20;class e1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=(t,e)=>{var i,n,s;const r=this.series;return(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform?"转化率":null!==(n=this._getDimensionData(t))&&void 0!==n?n:null===(s=t.properties)||void 0===s?void 0:s[`${r.getCategoryField()}`]},this.contentValueCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform){return`${(100*(null==t?void 0:t[U0])).toFixed(1)}%`}return this._getMeasureData(t)},this.contentKeyCallback=(t,e)=>{var i;if((null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)===jh.transform)return"转化率";const{dimensionFields:n,seriesFields:s}=this._seriesCacheInfo,r=n[n.length-1];return h(s[0])?null==t?void 0:t[s[0]]:null==t?void 0:t[r]}}}class i1 extends NZ{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class n1 extends i1{constructor(){super(...arguments),this.type=n1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}n1.type=Hh.polygon;class s1 extends NZ{constructor(){super(...arguments),this.type=s1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}s1.type=Hh.rule,pZ.useMark([n1,EQ,s1]);class r1 extends wQ{constructor(){super(...arguments),this.type=Fh.funnel,this._funnelMarkName=jh.funnel,this._funnelMarkType=Hh.polygon,this._transformMarkName=jh.transform,this._transformMarkType=Hh.polygon,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;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._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;hq(this._dataSet,"funnel",V0),hq(this._dataSet,"funnelTransform",W0);const t=new go(this._dataSet);t.parse([this.getViewData()],{type:"dataview"}),t.name=`${IN}_series_${this.id}_viewDataTransform`,this._viewDataTransform=new vQ(this._option,t)}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,n,s,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:Z0,asTransformRatio:G0,asReachRatio:U0,asHeightRatio:Y0,asValueRatio:X0,asNextValueRatio:K0,asLastValueRatio:$0,asLastValue:q0,asNextValue:J0,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(n=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===n?void 0:n.min,max:null!==(r=null===(s=this._spec.range)||void 0===s?void 0:s.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:Q0}})}initMark(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},r1.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},r1.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),(null===(n=null===(i=this._spec)||void 0===i?void 0:i.label)||void 0===n?void 0:n.visible)&&(this._labelMark=this._createMark(r1.mark.label,{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.label,key:this._seriesField})),(null===(a=null===(r=this._spec)||void 0===r?void 0:r.transformLabel)||void 0===a?void 0:a.visible)&&(this._transformLabelMark=this._createMark(r1.mark.transformLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.transformLabel,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(h=null===(l=this._spec)||void 0===l?void 0:l.outerLabel)||void 0===h?void 0:h.visible){const{line:t}=null!==(c=this._spec.outerLabel)&&void 0!==c?c:{},{line:e}=null!==(u=null===(d=this._theme)||void 0===d?void 0:d.outerLabel)&&void 0!==u?u:{};this._funnelOuterLabelMark.label=this._createMark(r1.mark.outerLabel,{themeSpec:null===(p=this._theme)||void 0===p?void 0:p.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel,depend:this._labelMark}),this._funnelOuterLabelMark.line=this._createMark(r1.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label,this._labelMark]})}}initTooltip(){this._tooltipHelper=new e1(this)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return[this._valueField]}getGroupFields(){return null}initMarkStyle(){var t,e,i,n;const s=this._funnelMark;s&&(this.setMarkStyle(s,{points:t=>this.getPoints(t),visible:t=>h(t[this._valueField]),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(s),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(s));const r=this._funnelTransformMark;r&&(this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",yK.Series),this._trigger.registerMark(r),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(r));const a=this._labelMark;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(a),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(a));const o=this._transformLabelMark;o&&(this.setMarkStyle(o,{text:t=>`${(100*rl(U0).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,limit:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",yK.Series),this._trigger.registerMark(o),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(o));const l=this._funnelOuterLabelMark.label;l&&this.setMarkStyle(l,{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,limit:t=>this._computeOuterLabelLimit(t)},"normal",yK.Series);const c=this._funnelOuterLabelMark.line;c&&l&&this.setMarkStyle(c,{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",yK.Series)}initAnimation(){var t,e,i,n,s;const 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(qJ($J.cartesianGroup({direction:()=>this._isHorizontal()?"x":"y",width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,orient:()=>this._isReverse()?"negative":"positive"},r),ZJ(jh.group,this._spec))),[this._labelMark,null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label,this._transformLabelMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qJ($J.funnel({},r),ZJ(t.name,this._spec)))})),(null===(s=this._funnelOuterLabelMark)||void 0===s?void 0:s.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qJ($J.label(),ZJ(jh.outerLabelLine,this._spec)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}setValueFieldToStack(){}setValueFieldToPercent(){}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 n,s;e?(n="rect"===this._shape?this._getSecondaryAxisLength(t[$0])/2:this._getSecondaryAxisLength(t[X0])/2,s=this._getSecondaryAxisLength(t[X0])/2):(n=this._getSecondaryAxisLength(t[X0])/2,s="rect"===this._shape?n:this._getSecondaryAxisLength(t[K0])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],n,s,n,s,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[Q0])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===n?void 0:n.call(i,(e=>e[this._categoryField]===t));return h(s)?this._getPolygonCenter(this.getPoints(s)):null}dataToPosition(t){return this.valueToPosition(t[this._categoryField])}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewDataStatistics().latestData[this.getCategoryField()].values.length,n=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,s=!!this._spec.isTransform,r=s?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=s?Math.max(0,i-1):0,o=(n-r*Math.max(0,i-1))/(i+.5*a);return t?s?.5*o:0:o}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),n=this._computeMinSize();return n+(i-n)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._seriesField]===t[this._seriesField]));if(!h(i)||i<0)return{};const n=this.isTransformLevel(t),s=this._isHorizontal(),r=s?this.getLayoutRect().height:this.getLayoutRect().width,a=s?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const c=this._getMainAxisLength(),d=this._getMainAxisLength(!0);return l+=i*(c+d),l+=n?-d/2:c/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,n,s,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-n},{x:a+r,y:o-s},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-n},{x:a+r,y:o+n},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-n,y:o+r},{x:a-s,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+n,y:o-r},{x:a+s,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,n;return this._isHorizontal()?(n="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)):(n="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][n]-=e,t[1][n]-=e,t[2][n]-=i,t[3][n]-=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(y(i))return i;const n=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(n[3].x-n[0].x):(Math.abs(n[0].x-n[1].x)+Math.abs(n[2].x-n[3].x))/2:this._isHorizontal()?Math.abs(n[3].x-n[0].x):this._computeMaxSize()}_computeOuterLabelPosition(t){var e,i;let n,s,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:n,y:s}=this._getPositionByData(t)),"left"===r?(n=0,a="left"):"right"===r?(n=this.getLayoutRect().width,a="right"):"top"===r?(s=0,o="top"):"bottom"===r&&(s=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);n=e,s=i,"left"===r?(n-=5,a="right"):"right"===r?(n+=5,a="left"):"top"===r?(s-=5,o="bottom"):"bottom"===r&&(s+=5,o="top")}return{x:n,y:s,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,n,s,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=null===(s=null===(n=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getProduct())||void 0===i?void 0:i.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[this.getCategoryField()])===t[this.getCategoryField()]})))||void 0===s?void 0:s.getBounds(),c=h?h.x2-h.x1:0;return this.getLayoutRect().width/2-Math.max(l/2,c/2)-t1-2*(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m;const y=this.getCategoryField(),_=null===(r=null===(s=null===(n=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===n?void 0:n.elements)||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===r?void 0:r.getBounds(),b=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getProduct())||void 0===o?void 0:o.elements)||void 0===l?void 0:l.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[y])===t[y]})))||void 0===h?void 0:h.getBounds();let x,S,w,A;if(this._isHorizontal()){const e=null!==(d=null===(c=this._spec.outerLabel)||void 0===c?void 0:c.spaceWidth)&&void 0!==d?d:5,i=this.getPoints(t),n=(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?(w=this._getPolygonCenter(i).y-n/2-e,A=!1!==(null===(u=this._spec.outerLabel)||void 0===u?void 0:u.alignLabel)?(null==_?void 0:_.y2)+e:w-e,x=this._getPolygonCenter(i).x,w-A{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series);const e=this._labelMark;e&&this.setMarkStyle(e,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",yK.Series)}}l1.type=Fh.funnel3d,l1.mark=sc,pZ.useSeries([l1]);class h1 extends N0{constructor(){super(...arguments),this.type=jQ.funnel3d,this.seriesType=Fh.funnel3d}}h1.type=jQ.funnel3d,h1.view="singleDefault";class c1 extends wQ{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=sV,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=h(t)?V(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=h(t)?V(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=V(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()}valueToPosition(t,e){if(l(t)||l(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.angleAxisHelper.dataToPosition(V(t)),n=this.radiusAxisHelper.dataToPosition(V(e));return this.angleAxisHelper.coordToPoint({angle:i,radius:n})}dataToPosition(t){return t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):{x:Number.NaN,y:Number.NaN}}dataToPositionX(t){return this.dataToPosition(t).x}dataToPositionY(t){return this.dataToPosition(t).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:[]};ol(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:[]};ol(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}_getDefaultSpecFromChart(t){const{outerRadius:e,innerRadius:i}=t;return{outerRadius:e,innerRadius:i}}setAttrFromSpec(){super.setAttrFromSpec(),h(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),h(this._spec.radius)&&(this._outerRadius=this._spec.radius),h(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),h(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}updateSpec(t){const e=this._originalSpec,{angleField:i,radiusField:n}=e,s=super.updateSpec(t);return vo(t.angleField,i)&&vo(t.radiusField,n)||(s.change=!0,s.reRender=!0,s.reMake=!0),s}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([...this._angleField,...this._radiusField])}_computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}setValueFieldToStackOffsetSilhouette(){}fillData(){super.fillData(),this.sortDataByAxis&&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)&&AQ(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}}class d1 extends c1{constructor(){super(...arguments),this._stack=!0}setAttrFromSpec(){var t,e,i,n,s;super.setAttrFromSpec();const r=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec();this._startAngle=null!==(i=null!==(e=Xo(this._spec.startAngle))&&void 0!==e?e:Xo(null==r?void 0:r.startAngle))&&void 0!==i?i:tV,this._endAngle=null!==(s=null!==(n=Xo(this._spec.endAngle))&&void 0!==n?n:Xo(null==r?void 0:r.endAngle))&&void 0!==s?s:eV,this.setAngleField(this._spec.valueField||this._spec.angleField),this.setRadiusField(this._spec.categoryField||this._spec.radiusField)}getStackGroupFields(){return this._radiusField}getStackValueField(){var t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const n=t[i];"conical"!==(null==n?void 0:n.gradient)||h(null==n?void 0:n.startAngle)||h(null==n?void 0:n.endAngle)||(e[i]=Object.assign(Object.assign({},n),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStart(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[_K]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this._startAngle}_getAngleValueEnd(t){if(this._stack){const e=bh(this.angleAxisHelper.dataToPosition([t[bK]]),this.angleAxisHelper.getScale(0));if(_(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._radiusField}getMeasureField(){return this._angleField}}class u1 extends NZ{constructor(){super(...arguments),this.type=u1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}u1.type=Hh.path,pZ.useMark([u1,HQ]);class p1 extends d1{constructor(){super(...arguments),this.type=Fh.gaugePointer,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)?Hh.rect:Hh.path}initMark(){this._pinBackgroundMark=this._createMark(p1.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p1.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p1.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){var t;const e=this._pointerMark,i=this._spec.pointer;e&&(this.setMarkStyle(e,{x:()=>{var t,e;const{x:n}=this.angleAxisHelper.center();return n-this._getPointerWidth()*(null!==(e=null===(t=null==i?void 0:i.center)||void 0===t?void 0:t[0])&&void 0!==e?e:0)},y:t=>{var e,n;const{y:s}=this.angleAxisHelper.center();return s-this._getPointerHeight(t)*(null!==(n=null===(e=null==i?void 0:i.center)||void 0===e?void 0:e[1])&&void 0!==n?n:0)},anchor:()=>{const{x:t,y:e}=this.angleAxisHelper.center();return[t,e]},fill:this.getColorAttribute(),zIndex:200}),this._pointerType===Hh.path?this.setMarkStyle(e,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(e,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const n=this._spec.pointer,s=this._radiusField[0];return h(this.radiusAxisHelper)&&h(s)?this.radiusAxisHelper.dataToPosition([t[s]])-(null!==(e=null==n?void 0:n.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==n?void 0:n.outerPadding)&&void 0!==i?i:10):n.height*this._computeLayoutRadius()}_getPointerAngle(t){return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}_getRotatedPointerCenterOffset(t){var e,i,n,s;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!==(s=null===(n=null==r?void 0:r.center)||void 0===n?void 0:n[1])&&void 0!==s?s: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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().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:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.pointer,this._spec)))}getDefaultShapeType(){return"circle"}}p1.type=Fh.gaugePointer,p1.mark=dc;class g1 extends L0{constructor(){super(...arguments),this._cacheStateStyle={}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{innerPadding:0,outerPadding:0})}_filterStyle(t,e,i,n=this.stateStyle){var s,r,a,l,c,d;h(t.innerRadius)&&this.setAttribute("innerRadius",this._styleConvert(t.innerRadius),e,i,this._cacheStateStyle),h(t.outerRadius)&&this.setAttribute("outerRadius",this._styleConvert(t.outerRadius),e,i,this._cacheStateStyle);const u=null!==(s=t.innerPadding)&&void 0!==s?s:n[e].innerPadding.style,p=null!==(r=t.outerPadding)&&void 0!==r?r:n[e].outerPadding.style,g=null!==(l=null!==(a=t.innerRadius)&&void 0!==a?a:this._cacheStateStyle[e].innerRadius.style)&&void 0!==l?l:n[e].innerRadius.style,f=null!==(d=null!==(c=t.outerRadius)&&void 0!==c?c:this._cacheStateStyle[e].outerRadius.style)&&void 0!==d?d:n[e].outerRadius.style;if(0===g&&0===f)return t;const v=h(t.innerPadding)&&h(g)||h(t.outerPadding)&&h(f),m=h(t.innerRadius)&&u||h(t.outerRadius)&&p;if(v||m){const e=Object.assign({},t);return u&&h(g)&&(o(g)?e.innerRadius=(t,e,i,n)=>g(t,e,i,n)+(o(u)?u(t,e,i,n):u):o(u)?e.innerRadius=(t,e,i,n)=>{const s=u(t,e,i,n);return g+s}:e.innerRadius=g+u),p&&h(f)&&(o(f)?e.outerRadius=(t,e,i,n)=>f(t,e,i,n)-(o(p)?p(t,e,i,n):p):o(p)?e.outerRadius=(t,e,i,n)=>{const s=p(t,e,i,n);return f-s}:e.outerRadius=f-p),e}return t}}g1.type=Hh.arc,g1.constructorType=Hh.progressArc,pZ.useMark([g1]);class f1 extends d1{constructor(){super(...arguments),this.type=Fh.gauge,this._segmentMark=null,this._trackMark=null,this._stack=!1,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Xo(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();hq(this._option.dataSet,"spiltSegment",((t,e)=>{const i=[...t];return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[EK]=t[this._angleField[0]],t[TK]=e>0?i[e-1][EK]:void 0})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){this._trackMark=this._createMark(f1.mark.track),this._segmentMark=this._createMark(f1.mark.segment,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t,e;const i=this._segmentMark;i&&(this.setMarkStyle(i,{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}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}initTrackMarkStyle(){const t=this._trackMark;t&&(this.setMarkStyle(t,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,cornerRadius:this._spec.cornerRadius,zIndex:100}),this._trigger.registerMark(t))}_getAngleValueStart(t){var e;return(h(t[TK])?this.angleAxisHelper.dataToPosition([t[TK]]):this._startAngle)+(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}_getAngleValueEnd(t){var e;return this.angleAxisHelper.dataToPosition([t[EK]])-(null!==(e=this._spec.padAngle)&&void 0!==e?e:0)/2}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.segment,this._spec)))}getDefaultShapeType(){return"circle"}}f1.type=Fh.gauge,f1.mark=cc;const v1={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function m1(t){let e=0;return T(t,"tick.visible")&&(e+=T(t,"tick.tickSize")),T(t,"label.visible")&&(e+=T(t,"label.space")),e}function y1(t,e){var i,n,s,r,a,o;return{min:null!==(s=null!==(i=t.min)&&void 0!==i?i:null===(n=t.range)||void 0===n?void 0:n.min)&&void 0!==s?s: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 _1(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}function b1(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}const x1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisX:o,axisY:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:["linear","log","symlog"].includes(e)?a:{})&&void 0!==s?s:{},VK(t)?o:l)},S1=(t,e,i)=>{var n,s;const{axisBand:r,axisLinear:a,axisAngle:o,axisRadius:l,axis:h}=null!==(n=i.component)&&void 0!==n?n:{};return Lh({},h,null!==(s="band"===e?r:"linear"===e?a:{})&&void 0!==s?s:{},"angle"===t?o:l)};class w1 extends LQ{isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}getIndicatorSpec(t){var e,i,n;const s=V(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(n=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===n?void 0:n.innerRadius;return h(r)&&s.forEach((t=>{l(t.limitRatio)&&(t.limitRatio=r)})),s}transformSpec(t){super.transformSpec(t),t.dataZoom&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{t.filterMode===OZ.axis&&(t.filterMode=OZ.filter)}));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],h(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A1 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i){var n;t.axes||(t.axes=[]);const s={radius:null,angle:null};(null!==(n=t.axes)&&void 0!==n?n:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(s.radius=t),"angle"===e&&(s.angle=t)})),s.angle||(s.angle=e,t.axes.push(s.angle)),s.radius||(s.radius=i,t.axes.push(s.radius)),l(s.angle.type)&&(s.angle.type="linear"),l(s.radius.type)&&(s.radius.type="band");const r=y1(s.angle,{min:0,max:1});l(s.angle.min)&&(s.angle.min=r.min),l(s.angle.max)&&(s.angle.max=r.max)}}pZ.useSeries([p1,f1]);class k1 extends A1{constructor(){super(...arguments),this.type=jQ.gauge,this.seriesType=Fh.gaugePointer}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:Fh.circularProgress})}transformSpec(t){var e,i,n,s;super.transformSpec(t);let r=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===Fh.gauge||t.type===Fh.circularProgress));l(r)&&(r=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===r.type&&l(r.radiusField)&&l(r.categoryField)&&(r.radiusField=null!==(s=null!==(n=t.radiusField)&&void 0!==n?n:t.categoryField)&&void 0!==s?s:t.seriesField),1===t.series.length?t.series.push(r):t.series.forEach((t=>{t.type===r.type&&Object.keys(r).forEach((e=>{e in t||(t[e]=r[e])}))}))),r.type===Fh.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1}):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)),l(i.angle.type)&&(i.angle.type="linear"),l(i.radius.type)&&(i.radius.type="linear")}}k1.type=jQ.gauge,k1.view="singleDefault";class M1 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return h(i)&&"dimension"===t&&(i.visible=!1),i}}class C1 extends PQ{constructor(){super(...arguments),this.type=C1.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}C1.type=Hh.cell,pZ.useMark([C1,EQ]);class T1 extends kQ{constructor(){super(...arguments),this.type=Fh.heatmap}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=V(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(T1.mark.cell,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("cell",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t}),this._backgroundMark=this._createMark(T1.mark.cellBackground,{progressive:t})}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){var t;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",yK.Series),this._trigger.registerMark(this._cellMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._cellMark)}initCellBackgroundMarkStyle(){var t,e,i;const n=Ze(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+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",yK.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDefaultColorScale(),field:this.getFieldValue[0]}}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._cellMark.setAnimationConfig(qJ($J.heatmap(i),ZJ(jh.cell,this._spec),{dataIndex:t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0}}))}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}updateSpec(t){const{direction:e}=this._spec,i=super.updateSpec(t);return t.direction!==e&&(i.change=!0,i.reRender=!0,i.reMake=!0),i}initTooltip(){this._tooltipHelper=new M1(this)}getDefaultShapeType(){return"square"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}}T1.type=Fh.heatmap,T1.mark=vc,pZ.useSeries([T1]);class E1 extends FQ{constructor(){super(...arguments),this.type=jQ.heatmap,this.seriesType=Fh.heatmap}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}E1.type=jQ.heatmap,E1.view="singleDefault";class P1 extends FQ{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field})}}pZ.useSeries([NQ]);class R1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram,this.seriesType=Fh.bar}transformSpec(t){super.transformSpec(t),dZ(t)}}R1.type=jQ.histogram,R1.view="singleDefault",pZ.useSeries([GQ]);class O1 extends P1{constructor(){super(...arguments),this.type=jQ.histogram3d,this.seriesType=Fh.bar3d}}O1.type=jQ.histogram3d,O1.view="singleDefault",pZ.useMark([CQ,RQ,EQ]);class B1 extends kQ{constructor(){super(...arguments),this.type=Fh.line,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._lineMark.setAnimationConfig(qJ($J.line(i,n),ZJ(jh.line,this._spec))),this._symbolMark&&this._symbolMark.setAnimationConfig(qJ($J.symbol(),ZJ(jh.point,this._spec)))}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var n,s;return i&&"fill"===e&&(e="stroke"),null!==(s=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==s?s:null}}getDefaultShapeType(){return"circle"}}B1.type=Fh.line,B1.mark=Uh,N(B1,iQ),pZ.useSeries([B1]);class I1 extends FQ{constructor(){super(...arguments),this.type=jQ.line,this.seriesType=Fh.line}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint})}transformSpec(t){super.transformSpec(t),dZ(t)}}I1.type=jQ.line,I1.view="singleDefault",Pr();const D1={},L1=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function F1(t,e){t&&g(t)||Oo("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(D1[i]=function(t,e){return function i(){const n=e();return n.type=t,n.path=Pr().projection(n),n.copy=n.copy||function(){const t=i();return L1.forEach((e=>{n[e]&&t[e](n[e]())})),t.path.pointRadius(n.path.pointRadius()),t},n}}(i,e)),D1[i]||null}const j1={albers:Kr,albersusa:function(){var t,e,i,n,s,r,a=Kr(),o=$r().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$r().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||(n.point(e,a),r)||(s.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),n=(t[0]-i[0])/e,s=(t[1]-i[1])/e;return(s>=.12&&s<.234&&n>=-.425&&n<-.214?o:s>=.166&&s<.234&&n>=-.214&&n<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(n=[a.stream(e=i),o.stream(i),l.stream(i)],s=n.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(j1).forEach((t=>{F1(t,j1[t])}));const z1="Feature",H1="FeatureCollection";function N1(t){const e=V(t);return 1===e.length?e[0]:{type:H1,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===H1?t.features:V(t).filter((t=>!l(t))).map((t=>t.type===z1?t:{type:z1,geometry:t}))}(e))),[])}}const V1=L1.concat(["pointRadius","fit","extent","size"]);function W1(t,e){let i=[];return t?(Object.keys(t).forEach((n=>{V1.includes(n)&&(i=i.concat(wV(t[n],e)))})),i):i}const G1=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,n=e.key,s=e.values,r=e.default,a=e.as||[i],c=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let d;if(o(e.set))d=function(t){const i=c.get(t[n]);e.set(t,i)};else if(s){const t=s.length;d=function(e){const i=c.get(e[n]);if(l(i))for(let i=0;i(d(t),t)))};class U1 extends wQ{constructor(){super(...arguments),this.type=Fh.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}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){var e;let i=null;if(!t)return i;const{dataToPosition:n,latitudeField:s,longitudeField:r}=this._coordinateHelper;if(i=this.nameToPosition(t),null===i){const a=r?null==t?void 0:t[r]:Number.NaN,o=s?null==t?void 0:t[s]:Number.NaN;i=null!==(e=null==n?void 0:n([a,o]))&&void 0!==e?e:null}return i}nameToPosition(t){var e,i;const n=this._getDatumName(t);if(l(n))return null;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((t=>this._getDatumName(t)===n))[0];if(l(s))return null;const{dataToPosition:r}=this._coordinateHelper,a=this._getDatumCenter(s),o=null==r?void 0:r(a);return l(o)||isNaN(o.x)||isNaN(o.y)?null:o}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){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}dataToPositionZ(t){return this._option.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}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}compileData(){var t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${IN}_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,n,s,r,a;return this._seriesField?null!==(a=null!==(n=null===(i=null===(e=null===(t=this._rawDataStatistics)||void 0===t?void 0:t.latestData)||void 0===e?void 0:e[this._seriesField])||void 0===i?void 0:i.values)&&void 0!==n?n:null===(r=null===(s=this._mapViewDataStatistics)||void 0===s?void 0:s.latestData[this._seriesField])||void 0===r?void 0:r.values)&&void 0!==a?a:[]: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()}}const Y1=`${IN}_MAP_LOOK_UP_KEY`,X1=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var n,s;t[gK]=i,e.nameMap?t[Y1]=e.nameMap[null===(n=t.properties)||void 0===n?void 0:n[e.nameProperty]]:t[Y1]=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty]})),t.features);class $1 extends uQ{constructor(){super(...arguments),this.titleValueCallback=t=>{var e,i;const n=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:null===(i=t.properties)||void 0===i?void 0:i[`${n.getNameProperty()}`]}}}var K1,q1,Z1;pZ.useMark([u1,EQ]),K1="projection",q1=class extends kG{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return l(this.spec.pointRadius)||this.detach(wV(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(wV(t,this.view)),this.commit(),this}size(t){return l(this.spec.size)||this.detach(wV(this.spec.size,this.view)),this.spec.size=t,this.attach(wV(t,this.view)),this.commit(),this}extent(t){return l(this.spec.extent)||this.detach(wV(this.spec.extent,this.view)),this.spec.extent=t,this.attach(wV(t,this.view)),this.commit(),this}fit(t){return l(this.spec.fit)||this.detach(wV(this.spec.fit,this.view)),this.spec.fit=t,this.attach(wV(t,this.view)),this.commit(),this}configure(t){return this.detach(W1(this.spec,this.view)),l(t)?this.spec={type:this.spec.type,fit:this.spec.fit,extent:this.spec.extent,size:this.spec.size,pointRadius:this.spec.pointRadius}:(Object.assign(this.spec,t),this.attach(W1(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=F1((t||"mercator").toLowerCase());return e||Oo("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),L1.forEach((t=>{var i,n,s;l(this.spec[t])||(i=this.projection,n=t,s=kV(this.spec[t],e,F1),o(i[n])&&i[n](s))})),l(this.spec.pointRadius)||this.projection.path.pointRadius(kV(this.spec.pointRadius,e,F1)),!(l(this.spec.fit)||l(this.spec.extent)&&l(this.spec.size))){const t=N1(kV(this.spec.fit,e,F1));this.spec.extent?this.projection.fitExtent(kV(this.spec.extent,e,F1),t):this.spec.size&&this.projection.fitSize(kV(this.spec.size,e,F1),t)}return this.projection}output(){return this.projection}},Z1="projections",L$[K1]={grammarClass:q1,specKey:null!=Z1?Z1:K1};class J1 extends U1{constructor(){super(...arguments),this.type=Fh.map,this._areaCache=new Map}getNameMap(){return this._nameMap}setAttrFromSpec(){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.map||this._option.onError(`map type '${this.map}' is not specified !`),dq.get(this.map)||this._option.onError(`'${this.map}' data is not registered !`)}initData(){var t;super.initData(),hq(this._dataSet,"copyDataView",fq),hq(this._dataSet,"map",X1),hq(this._dataSet,"lookup",G1);const e=dq.get(this.map);e||this._option.onError("no valid map data found!");const i=new go(this._dataSet);i.parse([e],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0}}).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:Y1,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(t=this._data)||void 0===t||t.getDataView().target.addListener("change",i.reRunAllTransform),this._mapViewData=new vQ(this._option,i)}initMark(){var t;this._pathMark=this._createMark(J1.mark.area,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("area",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}),(null===(t=this._spec.label)||void 0===t?void 0:t.visible)&&(this._labelMark=this._createMark(J1.mark.label,{parent:this.getRegion().getGroupMark(),skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()}))}initMarkStyle(){var t;const e=this._pathMark;e&&(this.setMarkStyle(e,{fill:t=>{var e,i,n,s;return h(t[null!==(e=this._seriesField)&&void 0!==e?e:vK])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this.getDefaultColorScale()).scale(t[null!==(n=this._seriesField)&&void 0!==n?n:vK]):null===(s=this._spec)||void 0===s?void 0:s.defaultFillColor},path:this.getPath.bind(this)},"normal",yK.Series),e.setPostProcess("fill",(t=>h(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(e,{smoothScale:!0},"normal",yK.Built_In),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e));const i=this._labelMark;i&&this.setMarkStyle(i,{text:t=>{var e,i;const n=this._getDatumName(t);return o(null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)?this._spec.label.formatMethod(n,t):n},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(){this._pathMark.setAnimationConfig(qJ($J.path(),ZJ(jh.area,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initTooltip(){this._tooltipHelper=new $1(this)}getPath(t){var e;const i=this._areaCache.get(t[gK]);if(i)return i.shape;const n=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[gK],{shape:n}),n}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._trigger=this._mapViewData=null}updateSpec(t){const e=this._originalSpec,{map:i,nameMap:n,valueField:s,nameProperty:r}=e,a=super.updateSpec(t);return(null==t?void 0:t.map)===i&&(null==t?void 0:t.nameMap)===n&&(null==t?void 0:t.valueField)===s&&(null==t?void 0:t.nameProperty)===r||(a.change=!0,a.reRender=!0,a.reMake=!0),a}handleZoom(t){const{scale:e,scaleCenter:i}=t;1!==e&&this.getMarksWithoutRoot().forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements;t.type===Hh.path?n.group.getGroupGraphicItem().scale(e,e,i):s.forEach((t=>{const e=t.getGraphicItem(),i=t.getDatum(),n=this.dataToPosition(i);n&&e&&e.translateTo(n.x,n.y)}))}))}handlePan(t){const{delta:e}=t;0===e[0]&&0===e[1]||this.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;t.type===Hh.path?i.group.getGroupGraphicItem().translate(e[0],e[1]):n.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}_getDatumCenter(t){var e,i;return _(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(e=t.properties)||void 0===e?void 0:e.center)?t.properties.center:(null===(i=t.properties)||void 0===i?void 0:i.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}_getDatumName(t){var e,i,n,s;return t[this.nameField]?t[this.nameField]:(null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty])?(null===(i=this._spec)||void 0===i?void 0:i.nameMap)?null!==(n=this._spec.nameMap[t.properties[this._nameProperty]])&&void 0!==n?n:"":null!==(s=t.properties[this._nameProperty])&&void 0!==s?s:"":""}dataToPositionX(t){return this._option.onError("Method not implemented."),0}dataToPositionY(t){return this._option.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,n;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(n=this._mapViewData)||void 0===n||n.updateData()}_getDataIdKey(){return gK}}J1.type=Fh.map,J1.mark=Jh,pZ.useSeries([J1]);class Q1 extends LQ{constructor(){super(...arguments),this.type=jQ.map,this.seriesType=Fh.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor})}isValidSeries(t){return t===Fh.map}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}function t2(t){return To(t)?Number.parseFloat(t):0}Q1.type=jQ.map,Q1.view="singleDefault";const e2=(t,e)=>{const i=t.map((t=>Object.assign({},t)));if(!i||0===i.length)return i;const{angleField:n,startAngle:s,endAngle:r,asStartAngle:a,asEndAngle:o,asMiddleAngle:l,asRadian:h,asRatio:c,asQuadrant:d,asK:u}=e;let p=0,g=-1/0;for(let t=0;t{const e=t2(t[n]),i=p?e/p:0,s=i*f;c&&(t[c]=i),a&&(t[a]=v),o&&(t[o]=v+s),l&&(t[l]=v+s/2),h&&(t[h]=s),d&&(t[d]=function(t){return(t=Yo(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}(v+s/2)),u&&(t[u]=g?e/g:0),v=t[o]})),0!==p&&(i[i.length-1][o]=r),i};pZ.useMark([u1,EQ,F0]);class i2 extends c1{constructor(){super(...arguments),this._pieMarkName=jh.pie,this._pieMarkType=Hh.arc,this._startAngle=tV,this._endAngle=eV,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this.dataToCentralPosition=t=>{const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeDatumInnerRadius(t),s=this.computeCenter(t),r=$o({angle:e,radius:(i+n)/2});return{x:s.x+r.x,y:s.y+r.y}}}get center(){var t,e,i,n;return{x:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerX)&&void 0!==e?e:this._region.getLayoutRect().width/2,y:null!==(n=null===(i=this._spec)||void 0===i?void 0:i.centerY)&&void 0!==n?n:this._region.getLayoutRect().height/2}}setAttrFromSpec(){var t,e,i,n,s,r,a;super.setAttrFromSpec(),this._centerOffset=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.centerOffset)&&void 0!==e?e:0,this._cornerRadius=null!==(n=null===(i=this._spec)||void 0===i?void 0:i.cornerRadius)&&void 0!==n?n:0;const o=function(t,e){let i=0,n=2*Math.PI;const s=h(t),r=h(e);for(s||r?r?s?(i=t,n=e):(i=e-2*Math.PI,n=e):(i=t,n=t+2*Math.PI):(i=0,n=2*Math.PI);n<=i;)n+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,n-=2*Math.PI;for(;n<0;)i+=2*Math.PI,n+=2*Math.PI;return{startAngle:i,endAngle:n}}(h(null===(s=this._spec)||void 0===s?void 0:s.startAngle)?Xo(this._spec.startAngle):this._startAngle,h(null===(r=this._spec)||void 0===r?void 0:r.endAngle)?Xo(this._spec.endAngle):this._endAngle);this._startAngle=o.startAngle,this._endAngle=o.endAngle,this._padAngle=h(null===(a=this._spec)||void 0===a?void 0:a.padAngle)?Xo(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[]}initData(){super.initData();const t=this.getViewData();if(!t)return;hq(this._dataSet,"pie",e2),t.transform({type:"pie",options:{angleField:this._angleField[0],startAngle:this._startAngle,endAngle:this._endAngle,asStartAngle:GN,asEndAngle:UN,asRatio:WN,asMiddleAngle:ZN,asRadian:QN,asQuadrant:JN,asK:YN}},!1);const e=new go(this._dataSet);e.parse([this.getViewData()],{type:"dataview"}),e.name=`${IN}_series_${this.id}_viewDataLabel`,this._viewDataLabel=new vQ(this._option,e)}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},i2.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{morph:tQ(this._spec.animation,this._spec.morph,ZJ(this.type,this._spec)),defaultMorphElementKey:this._seriesField,key:fK,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}initMarkStyle(){var t;const e=this._pieMark;e&&(this.setMarkStyle(e,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},fill:this.getColorAttribute(),outerRadius:xh(this._outerRadius)?this._outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:xh(this._innerRadius)?this._innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yK.User_Mark)}}initLabelMarkStyle(t){var e,i,n,s,r,a;t&&this.setMarkStyle(t,{visible:rl(HN).bind(this),text:t=>t[this.getDimensionField()[0]],fill:(null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)||this.getColorAttribute(),angle:null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.angle,limit:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.limit,z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,...this._radiusField])}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._angleField}viewDataLabelUpdate(){this.event.emit(cK.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){const e={};return(null==t?void 0:t.outerRadius)&&(e.outerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.outerRadius)),(null==t?void 0:t.innerRadius)&&(e.innerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.innerRadius)),(null==t?void 0:t.cornerRadius)&&(e.cornerRadius=()=>this.computeLayoutRadius()*(null==t?void 0:t.cornerRadius)),e}computeLayoutRadius(){const{width:t,height:e}=this._region.getLayoutRect();return Math.min(t/2,e/2)}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}generateLinePath(t){const e="normal"===t?"POINT":t.toUpperCase();return{path:t=>`M${Math.round(t[`${IN}_ARC_LABEL_${e}_AX`])},${Math.round(t[`${IN}_ARC_LABEL_${e}_AY`])} L${Math.round(t[XN])},${Math.round(t[$N])} L${Math.round(t[KN])},${Math.round(t[qN])}`}}getRadius(t="normal"){var e,i,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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,n,s,r,a,o;const l="normal"===t?null===(n=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===n?void 0:n.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(s=this._pieMark)||void 0===s?void 0:s.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}getLabelConfig(){var t,e,i,n,s,r,a,o,l;return Object.assign(Object.assign({visible:!0,position:"outside",showRule:"all",rotate:!0,coverEnable:!1,spaceWidth:5,layoutArcGap:6},this._spec.label),{style:Object.assign({visible:!0},null===(t=this._spec.label)||void 0===t?void 0:t.style),line:Object.assign({visible:!0,line1MinLength:null!==(n=null===(i=null===(e=this._spec.label)||void 0===e?void 0:e.line)||void 0===i?void 0:i.line1MinLength)&&void 0!==n?n:20,line2MinLength:null!==(a=null===(r=null===(s=this._spec.label)||void 0===s?void 0:s.line)||void 0===r?void 0:r.line2MinLength)&&void 0!==a?a:10},null===(o=this._spec.label)||void 0===o?void 0:o.line),layout:Object.assign({align:"arc",strategy:"priority",tangentConstraint:!0},null===(l=this._spec.label)||void 0===l?void 0:l.layout)})}computeRadius(t,e){return this.computeLayoutRadius()*t*(l(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this.computeLayoutRadius()*this.getRadius(e)+this._centerOffset}updateSpec(t){const e=this._originalSpec,{centerX:i,centerY:n,centerOffset:s,radius:r,innerRadius:a,cornerRadius:o,startAngle:l,endAngle:h,padAngle:c}=e,d=super.updateSpec(t);return(null==t?void 0:t.centerX)===i&&(null==t?void 0:t.centerY)===n&&(null==t?void 0:t.centerOffset)===s&&(null==t?void 0:t.radius)===r&&(null==t?void 0:t.innerRadius)===a&&(null==t?void 0:t.cornerRadius)===o&&(null==t?void 0:t.startAngle)===l&&(null==t?void 0:t.endAngle)===h&&(null==t?void 0:t.padAngle)===c||(d.reRender=!0,d.change=!0),d}computeDatumInnerRadius(t,e){return this.computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t){const e=t[ZN];if(l(e))return null;const i=this.computeDatumRadius(t),n=this.computeCenter(t),s=$o({angle:e,radius:i});return{x:n.x+s.x,y:n.y+s.y}}initAnimation(){var t,e;const i={growFrom:(t,e,i)=>{var n,s;if(i===_q.appear)return this._startAngle;if(i===_q.disappear)return this._endAngle;const r=[_q.disappear,_q.exit],a=e.mark.elements,o=t,l=null==o?void 0:o[gK];if(void 0===a.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])>l})))return this._endAngle;const h=a.findLast((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[gK])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+$o({angle:e[ZN],radius:a}).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+$o({angle:e[ZN],radius:a}).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){return e}}i2.mark=Kh;class n2 extends i2{constructor(){super(...arguments),this.type=Fh.pie}}n2.type=Fh.pie;class s2 extends w1{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle})}}pZ.useSeries([n2]);class r2 extends s2{constructor(){super(...arguments),this.type=jQ.pie,this.seriesType=Fh.pie}}r2.type=jQ.pie,r2.view="singleDefault";class a2 extends L0{constructor(){super(...arguments),this.type=a2.type}}a2.type=Hh.arc3d,pZ.useMark([u1,EQ,a2]);class o2 extends i2{constructor(){super(...arguments),this.type=Fh.pie3d,this._pieMarkName=jh.pie3d,this._pieMarkType=Hh.arc3d}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){var t,e,i,n,s,r,a,o;const l=this._pieMark;if(l){this.setMarkStyle(l,{x:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2},y:()=>{var t,e;return null!==(e=null===(t=this._center)||void 0===t?void 0:t.y)&&void 0!==e?e:this._region.getLayoutRect().height/2},beta:()=>this._angle3d,fill:this.getColorAttribute(),outerRadius:()=>this.computeLayoutRadius()*this._outerRadius,innerRadius:()=>this.computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this.computeLayoutRadius()*this._cornerRadius,startAngle:rl(GN).bind(this),endAngle:rl(UN).bind(this),padAngle:this._padAngle,centerOffset:this._centerOffset},"normal",yK.Series);const e=this.getSpec()[l.name];if(e)for(const t in e.state||{})this.setMarkStyle(l,this.generateRadiusStyle(e.state[t]),t,yK.User_Mark);this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l)}const h=this._labelMark,c=this.getSpec(),d={};(null===(e=null==c?void 0:c.label)||void 0===e?void 0:e.support3d)&&(d.beta=-Math.PI/3,d.anchor3d=t=>{var e,i,n,s;return[(null!==(i=null===(e=this._center)||void 0===e?void 0:e.x)&&void 0!==i?i:this._region.getLayoutRect().width/2)-rl(NN).bind(this)(t),(null!==(s=null===(n=this._center)||void 0===n?void 0:n.y)&&void 0!==s?s:this._region.getLayoutRect().height/2)-rl(VN).bind(this)(t)]}),h&&(this.setMarkStyle(h,Object.assign({visible:rl(HN).bind(this),x:rl(NN).bind(this),y:rl(VN).bind(this),text:rl(zN).bind(this),fill:(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill)||this.getColorAttribute(),textAlign:rl(jN).bind(this),textBaseline:"inside"===(null===(s=this._spec.label)||void 0===s?void 0:s.position)?"middle":"top",angle:t=>{var e;const i=t[ZN];return"inside"===(null===(e=this._spec.label)||void 0===e?void 0:e.position)?(t=>_(t)?qt(t):null)(i):0},limit:rl(FN).bind(this)},d),void 0,yK.User_Mark),this._trigger.registerMark(h));const u=this._labelLineMark;u&&(this.setMarkStyle(u,Object.assign(Object.assign(Object.assign({visible:rl(HN).bind(this),stroke:(null===(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.line)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||this.getColorAttribute(),lineWidth:1},this.generateLinePath("normal")),d),{anchor3d:()=>{var t,e,i,n;return[null!==(e=null===(t=this._center)||void 0===t?void 0:t.x)&&void 0!==e?e:this._region.getLayoutRect().width/2,null!==(n=null===(i=this._center)||void 0===i?void 0:i.y)&&void 0!==n?n:this._region.getLayoutRect().height/2]}})),this.setMarkStyle(u,this.generateLinePath("hover"),"hover"),this.setMarkStyle(u,this.generateLinePath("selected"),"selected"),this._trigger.registerMark(u))}}o2.type=Fh.pie3d,o2.mark=qh,pZ.useSeries([o2]);class l2 extends s2{constructor(){super(...arguments),this.type=jQ.pie3d,this.seriesType=Fh.pie3d}transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}l2.type=jQ.pie3d,l2.view="singleDefault",pZ.useMark([F0,g1]);class h2 extends d1{constructor(){super(...arguments),this.type=Fh.circularProgress,this._progressMark=null,this._trackMark=null}getStackGroupFields(){return this.getGroupFields()}getGroupFields(){return this._radiusField}initMark(){this._trackMark=this._createMark(h2.mark.track),this._progressMark=this._createMark(h2.mark.progress,{isSeriesMark:!0})}initMarkStyle(){this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMarkStyle(){var t,e;const i=this._progressMark;i&&(this.setMarkStyle(i,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0}),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}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]),n=this._getAngleValueStart(t);return Math.abs(n-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:this._getRadiusValueStart.bind(this),outerRadius:this._getRadiusValueEnd.bind(this),cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100}),this._trigger.registerMark(t))}_getRadiusValueStart(t){if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(_(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])}_getRadiusValueEnd(t){var e,i;if(this.getGroupFields().length>1){const n=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(_(n))return n}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])+this.radiusAxisHelper.getScale(0).step()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.circularProgress({startAngle:this._startAngle},i),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}}h2.type=Fh.circularProgress,h2.mark=Qh,pZ.useSeries([h2]);class c2 extends A1{constructor(){super(...arguments),this.type=jQ.circularProgress,this.seriesType=Fh.circularProgress}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,background:t.background})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1})}}c2.type=jQ.circularProgress,c2.view="singleDefault";class d2 extends uQ{getDefaultTooltipPattern(t,e){const i=super.getDefaultTooltipPattern(t,e);return"mark"===t?i:"dimension"===t?(i.visible=!1,i):null}}pZ.useMark([HQ]);class u2 extends kQ{constructor(){super(...arguments),this.type=Fh.linearProgress,this._progressMark=null,this._trackMark=null,this._progressGroupMark=null}initMark(){this.initProgressGroupMark(),this.initTrackMark(),this.initProgressMark()}initMarkStyle(){this.initProgressGroupMarkStyle(),this.initTrackMarkStyle(),this.initProgressMarkStyle()}initProgressMark(){return this._progressMark=this._createMark(u2.mark.progress,{isSeriesMark:!0,parent:this._progressGroupMark}),this._progressMark}initProgressMarkStyle(){var t,e,i,n,s,r,a,o,l;const h=this._progressMark;if(h){if("vertical"===this._spec.direction){const s=null!==(e=null===(t=this._spec.progress)||void 0===t?void 0:t.leftPadding)&&void 0!==e?e:0,r=null!==(n=null===(i=this._spec.progress)||void 0===i?void 0:i.rightPadding)&&void 0!==n?n:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2+s},y:t=>{var e,i;return bh(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))},height:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}else{const t=null!==(r=null===(s=this._spec.progress)||void 0===s?void 0:s.topPadding)&&void 0!==r?r:0,e=null!==(o=null===(a=this._spec.progress)||void 0===a?void 0:a.bottomPadding)&&void 0!==o?o:0;this.setMarkStyle(h,{x:t=>{var e,i;return bh(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))-this._xAxisHelper.dataToPosition([1],{bandPosition:this._bandPosition})},y:e=>{var i,n;return bh(this.dataToPositionY(e),null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0))-this._spec.bandWidth/2+t},height:this._spec.bandWidth-t-e,width:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([1],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()})}this._trigger.registerMark(h),null===(l=this._tooltipHelper)||void 0===l||l.activeTriggerSet.mark.add(h)}}initTrackMark(){return this._trackMark=this._createMark(u2.mark.track,{parent:this._progressGroupMark}),this._trackMark}initTrackMarkStyle(){var t,e,i,n,s;const r=this._trackMark;r&&("vertical"===this._spec.direction?this.setMarkStyle(r,{x:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius,fill:null===(e=null===(t=this._spec.track)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill}):this.setMarkStyle(r,{x:0,y:t=>{var e,i;return bh(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))-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius,fill:null===(n=null===(i=this._spec.track)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fill}),this._trigger.registerMark(r),null===(s=this._tooltipHelper)||void 0===s||s.activeTriggerSet.mark.add(r))}initProgressGroupMark(){return this._progressGroupMark=this._createMark(u2.mark.group,{skipBeforeLayouted:!1}),this._progressGroupMark}initProgressGroupMarkStyle(){const t=this._progressGroupMark;t.setZIndex(this.layoutZIndex),t.created(),this.setMarkStyle(t,{clip:!0,x:0,y:0,path:()=>{var t;const e=[];return null===(t=this._rawData)||void 0===t||t.rawData.forEach(((t,i)=>{var n,s,r,a;if("vertical"===this._spec.direction){const i=bh(this.dataToPositionX(t),null===(s=null===(n=this._xAxisHelper)||void 0===n?void 0:n.getScale)||void 0===s?void 0:s.call(n,0))-this._spec.bandWidth/2,r=this._scaleY.range()[0];e.push(HO({x:i,y:0,height:r,width:this._spec.bandWidth,cornerRadius:this._spec.cornerRadius,fill:!0}))}else{const i=bh(this.dataToPositionY(t),null===(a=null===(r=this._yAxisHelper)||void 0===r?void 0:r.getScale)||void 0===a?void 0:a.call(r,0))-this._spec.bandWidth/2,n=this._scaleX.range()[1];e.push(HO({x:0,y:i,height:this._spec.bandWidth,width:n,cornerRadius:this._spec.cornerRadius,fill:!0}))}})),e}},"normal",yK.Series),this._progressGroupMark.setInteractive(!1)}initAnimation(){var t,e;const i={direction:this.direction},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(qJ($J.linearProgress(i,n),ZJ(jh.progress,this._spec))),this._trackMark.setAnimationConfig(qJ($J.progressBackground(),ZJ(jh.track,this._spec)))}initTooltip(){this._tooltipHelper=new d2(this)}}u2.type=Fh.linearProgress,u2.mark=rc,pZ.useSeries([u2]);class p2 extends FQ{constructor(){super(...arguments),this.type=jQ.linearProgress,this.seriesType=Fh.linearProgress}needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const n=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},n),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,n=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(n=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="band"),l(i.type)&&(i.type="linear");const s=y1(i,{min:0,max:1});l(i.min)&&(i.min=s.min),l(i.max)&&(i.max=s.max)}else{let e=null,n=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(n=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),n||(n={orient:"bottom",visible:!1},t.axes.push(n)),l(n.type)&&(n.type="linear"),l(e.type)&&(e.type="band");const s=y1(n,{min:0,max:1});l(n.min)&&(n.min=s.min),l(n.max)&&(n.max=s.max)}}}p2.type=jQ.linearProgress,p2.view="singleDefault";class g2 extends c1{getStackGroupFields(){return this._angleField}getStackValueField(){return V(this._spec.valueField)[0]||V(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.setInnerRadiusField(this._spec.valueField||this._spec.radiusField),this._stack&&this.setValueFieldToStack(),this._percent&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(bK),this.setInnerRadiusField(_K)}setValueFieldToPercent(){this.setRadiusField(SK),this.setInnerRadiusField(xK)}getDimensionField(){return this._angleField}getMeasureField(){return this._radiusField}getDefaultShapeType(){return"square"}setValueFieldToStackOffsetSilhouette(){}}pZ.useMark([TQ,CQ,RQ,EQ]);class f2 extends g2{constructor(){super(...arguments),this.type=Fh.radar,this._sortDataByAxis=!1}initGroups(){}initMark(){var t,e,i,n;const s={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(n=this._spec.seriesMark)&&void 0!==n?n:"area";this.initAreaMark(s,r&&"area"===a),this.initLineMark(s,"line"===a||"area"===a&&!r),this.initSymbolMark(s,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle()}initAreaMark(t,e){this._areaMark=this._createMark(f2.mark.area,{progressive:t,isSeriesMark:e})}initAreaMarkStyle(){var t;const e=this._areaMark;e&&(this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),x1:t=>t&&this.angleAxisHelper&&this.radiusAxisHelper?this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this._stack?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:jK},"normal",yK.Series),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.dimension.add(e))}initAnimation(){var t,e,i,n;const s={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:null!==(t=Xo(this._spec.startAngle))&&void 0!==t?t:tV,pointToCoord:t=>{var e;return null===(e=this.angleAxisHelper)||void 0===e?void 0:e.pointToCoord(t)},coordToPoint:t=>this.angleAxisHelper.coordToPoint(t)},r=null!==(n=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset)&&void 0!==n?n:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(qJ($J.radarGroup(s,r),ZJ(jh.group,this._spec)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(h(t)){const i=$J[e];t.setAnimationConfig(qJ(i(s,r),ZJ(t.name,this._spec)))}}))}getDefaultShapeType(){return"square"}}f2.type=Fh.radar,f2.mark=$h,N(f2,iQ);class v2 extends w1{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}pZ.useSeries([f2]);class m2 extends v2{constructor(){super(...arguments),this.type=jQ.radar,this.seriesType=Fh.radar}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:Lh({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint})}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,smooth:!0}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}m2.type=jQ.radar,m2.view="singleDefault";class y2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{"rangeArea"===t.type&&n.push({seriesId:t.id,key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}const _2=Object.assign({},Xh);class b2 extends BQ{constructor(){super(...arguments),this.type=Fh.rangeArea}initMark(){this._areaMark=this._createMark(b2.mark.area,{defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0})}initMarkStyle(){var t,e,i,n,s;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===(s=null===(n=this.getSpec().line)||void 0===n?void 0:n.style)||void 0===s?void 0:s.curveType,a=r===FK?this._direction===HK.vertical?"monotoneX":"monotoneY":r,o=this._areaMark;o&&(this._direction===HK.vertical?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this)},"normal",yK.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),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})},y:this.dataToPositionY.bind(this),orient:this._direction},"normal",yK.Series),this.setMarkStyle(o,{fill:this.getColorAttribute(),stroke:!1},"normal",yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined,connectedType:this._getInvalidConnectType()},"normal",yK.Series),this.setMarkStyle(o,{curveType:a},"normal",yK.Built_In),this._trigger.registerMark(o),this._tooltipHelper.activeTriggerSet.dimension.add(o))}initTooltip(){this._tooltipHelper=new y2(this)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}}b2.type=Fh.rangeArea,b2.mark=_2,pZ.useSeries([b2]);class x2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeArea,this.seriesType=Fh.rangeArea}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign({},super._getDefaultSeriesSpec(t));return n.area=t.area,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n.stack=!1,n}transformSpec(t){super.transformSpec(t),dZ(t)}}function S2(t,e,i,n,s,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if(l()===HK.vertical)return"center";const e=s(t),n=r(t);if("middle"===i)return"center";if(e>=n){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(l()===HK.horizontal)return"middle";const e=a(t),n=o(t);if("middle"===i)return"middle";if(n>=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=s(t),o=r(t);if(e===HK.vertical)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+n;if("end"===i)return a-n;if("outside"===i)return a+n}else{if("start"===i)return o-n;if("end"===i)return a+n;if("outside"===i)return a-n}return(a+o)/2},y:t=>{const e=l(),s=a(t),r=o(t);if(e===HK.horizontal)return(s+r)/2;if("middle"===i)return(s+r)/2;if(s>=r){if("start"===i)return r+n;if("end"===i)return s-n;if("outside"===i)return s+n}else{if("start"===i)return r-n;if("end"===i)return s+n;if("outside"===i)return s-n}return(s+r)/2}},"normal",yK.Series)}x2.type=jQ.rangeArea,x2.view="singleDefault";class w2 extends uQ{getDefaultTooltipPattern(t){return{visible:!0,activeType:t,title:{key:void 0,value:this.titleValueCallback,hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>this.series.getSpec().direction===HK.horizontal?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]],hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1}]}}}class A2 extends NQ{constructor(){super(...arguments),this.type=Fh.rangeColumn,this._barMarkType=Hh.rect,this._barName=Fh.bar,this._stack=!1}initMark(){var t,e,i,n,s,r,a,o;const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._rectMark=this._createMark(A2.mark.bar,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("bar",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:l===Rq.bothEnd?void 0:Lh({},this._spec.label),isSeriesMark:!0}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&l===Rq.bothEnd&&(!1!==(null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===n?void 0:n.visible)&&(this._minLabelMark=this._createMark(A2.mark.minLabel,{markSpec:null===(s=this._spec.label)||void 0===s?void 0:s.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(A2.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e,i,n,s,r,a,o,l,h,c,d;super.initMarkStyle();const u=this._minLabelMark,p=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(u){this.setMarkStyle(u,{fill:null!==(i=null===(e=null==p?void 0:p.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});S2(this,u,null!==(n=null==p?void 0:p.position)&&void 0!==n?n:"end",null!==(s=null==p?void 0:p.offset)&&void 0!==s?s:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(r=this._tooltipHelper)||void 0===r||r.ignoreTriggerSet.mark.add(u)}const g=this._maxLabelMark,f=null===(a=this._spec.label)||void 0===a?void 0:a.maxLabel;if(g){this.setMarkStyle(g,{fill:null!==(l=null===(o=null==f?void 0:f.style)||void 0===o?void 0:o.fill)&&void 0!==l?l:this.getColorAttribute(),text:t=>{const e=this._spec.direction===HK.horizontal?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==f?void 0:f.formatMethod)?f.formatMethod(e,t):e}});S2(this,g,null!==(h=null==f?void 0:f.position)&&void 0!==h?h:"start",null!==(c=null==f?void 0:f.offset)&&void 0!==c?c:"vertical"===this._direction?-20:-25,(t=>this._rectMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("x",t)+this._rectMark.getAttribute("width",t):this._rectMark.getAttribute("x1",t)),(t=>this._rectMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._rectMark.getAttribute("y1",t):this._rectMark.getAttribute("y",t)+this._rectMark.getAttribute("height",t)),(()=>this._direction)),null===(d=this._tooltipHelper)||void 0===d||d.ignoreTriggerSet.mark.add(g)}}initLabelMarkStyle(t){var e;t&&(this.setMarkStyle(t,{text:t=>{let e,i;return this._spec.direction===HK.horizontal?(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}),null===(e=this._tooltipHelper)||void 0===e||e.ignoreTriggerSet.mark.add(t))}initBandRectMarkStyle(){var t,e,i,n;const s=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(n=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===n?void 0:n.call(i,0),{dataToPosition:a}=this.direction===HK.horizontal?this._xAxisHelper:this._yAxisHelper;this.direction===HK.horizontal?this.setMarkStyle(this._rectMark,{x:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition}),s),x1:t=>bh(a(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition}),s),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper)},"normal",yK.Series):this.setMarkStyle(this._rectMark,{x:t=>this._getPosition(this.direction,t),y:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition}),r),y1:t=>bh(a(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition}),r),width:()=>this._getBarWidth(this._xAxisHelper)},"normal",yK.Series)}initAnimation(){var t,e;const i=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._rectMark.setAnimationConfig(qJ($J.rangeColumn({direction:this.direction},n),ZJ(jh.bar,this._spec),{dataIndex:i})),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i})),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:i}))}initTooltip(){this._tooltipHelper=new w2(this)}}A2.type=Fh.rangeColumn,A2.mark=pc,pZ.useSeries([A2]);class k2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn,this.seriesType=Fh.rangeColumn}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar=t.bar,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}transformSpec(t){super.transformSpec(t),dZ(t)}}k2.type=jQ.rangeColumn,k2.view="singleDefault",pZ.useMark([WQ]);class M2 extends A2{constructor(){super(...arguments),this.type=Fh.rangeColumn3d,this._barMarkType=Hh.rect3d,this._barName=Fh.bar3d}}M2.type=Fh.rangeColumn3d,M2.mark=gc,pZ.useSeries([M2]);class C2 extends FQ{constructor(){super(...arguments),this.type=jQ.rangeColumn3d,this.seriesType=Fh.rangeColumn3d}_getDefaultSeriesSpec(t){var e,i;const n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return n.bar3d=t.bar3d,t.direction===HK.horizontal?n.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:n.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],n}}C2.type=jQ.rangeColumn3d,C2.view="singleDefault",pZ.useMark([F0,EQ]);class T2 extends g2{constructor(){super(...arguments),this.type=Fh.rose,this._stack=!0,this._roseMark=null,this._labelMark=null}initMark(){this.initRoseMark()}initMarkStyle(){this.initRoseMarkStyle()}initRoseMark(){this._roseMark=this._createMark(T2.mark.rose,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("rose",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,isSeriesMark:!0,label:Lh({animation:this._spec.animation},this._spec.label)})}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}initRoseMarkStyle(){var t;const e=this._roseMark;e&&(this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(0),endAngle:t=>this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(0),fill:this.getColorAttribute(),outerRadius:t=>bh(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this._stack)return 0;const i=bh(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}}),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}initLabelMarkStyle(t){var e,i,n,s,r,a,o,l;t&&this.setMarkStyle(t,{visible:null===(i=null===(e=this._spec)||void 0===e?void 0:e.label)||void 0===i?void 0:i.visible,text:t=>t[this.getDimensionField()[0]],fill:(null===(s=null===(n=this._spec.label)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)||this.getColorAttribute(),angle:null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.style)||void 0===a?void 0:a.angle,limit:null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.style)||void 0===l?void 0:l.limit,z:0})}initAnimation(){var t,e;const i=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(qJ($J.rose(t,i),ZJ(jh.rose,this._spec)))}}getDefaultShapeType(){return"circle"}}T2.type=Fh.rose,T2.mark=Zh,pZ.useSeries([T2]);class E2 extends v2{constructor(){super(...arguments),this.type=jQ.rose,this.seriesType=Fh.rose}_getDefaultSeriesSpec(t){var e,i,n;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:sV,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:sV,innerRadius:null!==(n=t.innerRadius)&&void 0!==n?n:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})}))})),t.crosshair=V(t.crosshair||{}).map((t=>Lh({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}E2.type=jQ.rose,E2.view="singleDefault";const P2=t=>{let e=0;return t.forEach(((t,i)=>{var n;l(t.value)&&((null===(n=t.children)||void 0===n?void 0:n.length)?t.value=P2(t.children):t.value=0),e+=Math.abs(t.value)})),e};function R2(t){return t.depth}function O2(t,e){return e-1-t.endDepth}const B2=(t,e)=>t.y0-e.y0,I2={left:R2,right:O2,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?G(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:R2,end:O2};class D2{constructor(t){this._ascendingSourceBreadth=(t,e)=>B2(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>B2(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},D2.defaultOptions,t);const e=this.options.nodeKey,i=o(e)?e:e?Io(e):null;this._getNodeKey=i,this._alignFunc=o(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):I2[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 n=this.computeNodeLinks(t),s=n.nodes,r=n.links;if(this._nodeMap=n.nodeMap,this.computeNodeValues(s),this.computeNodeDepths(s),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(s),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(s);return this.computeLinkBreadths(s),"vertical"===this.options.direction&&(s.forEach((t=>{const e=t.y0,i=t.y1;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}))),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:s,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],n={},s={},r=[];P2(t);const a=(t,i,s)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):s?`${s[s.length-1].key}-${o}`:`${i}-${o}`;if(n[l])n[l].value=void 0;else{const s={depth:i,datum:t,index:o,key:l,value:t.value,sourceLinks:[],targetLinks:[]};n[l]=s,e.push(s)}s&&r.push({source:s[s.length-1].key,target:l,value:t.value,parents:s}),t.children&&t.children.length&&a(t.children,i+1,s?s.concat([n[l]]):[n[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`;if(s[r])return s[r].value+=t.value,void s[r].datum.push(t);const a={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[t],value:t.value,parents:t.parents.map((t=>t.key))};i.push(a),n[t.source].sourceLinks.push(a),n[t.target].targetLinks.push(a),s[r]=a})),{nodes:e,links:i,nodeMap:n}}computeNodeLinks(t){if(!("links"in t))return this._isHierarchic=!0,this.computeHierarchicNodeLinks(t.nodes);const e=[],i=[],n={};if(t.nodes&&t.nodes.forEach(((t,i)=>{const s={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};n[s.key]=s,e.push(s)})),t.links.forEach(((s,r)=>{if(l(s.source)||l(s.target))return;if(t.nodes&&(!n[s.source]||!n[s.target]))return;t.nodes||n[s.source]||(n[s.source]={value:void 0,depth:-1,index:e.length,key:s.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.source])),t.nodes||n[s.target]||(n[s.target]={value:void 0,depth:-1,index:e.length,key:s.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(n[s.target]));const a={index:r,source:s.source,target:s.target,datum:s,value:s.value};i.push(a),n[s.source].sourceLinks.push(a),n[s.target].targetLinks.push(a)})),this.options.linkSortBy)for(let t=0,i=e.length;t{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=e.value)&&void 0!==i?i:0)}),0)))}}computeNodeDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,n,s=t,r=0;for(;s.length&&re&&Oo("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,n=this.options.minStepWidth,s=this._viewBox.width;let r=null,a=null,h=!1;if(g(e)){const t=ut(parseFloat(e.replace("%",""))/100,0,1);let i=s/(this._maxDepth-1+t);n>0&&(i=Math.max(n,i)),r=i*t,a=i*(1-t),h=!0}else if(y(e)){if(r=e,y(i))a=i;else if(l(i)){let t=(s-e)/(this._maxDepth-1);n>0&&(t=Math.max(n,t)),a=t-e}h=!0}else o(e)&&y(i)&&(a=i);const c=[];for(let e=0,i=t.length;eMath.max(t,e.length)),0);let s=Math.min(i>0?Math.max(this.options.nodeGap,i):this.options.nodeGap,this._viewBox.height/n);const r=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-(e.length-1)*s)/i)}),1/0);for(let n=0,a=t.length;n0?Math.max(n.value*r,i):n.value*r),o=n.y1+s;for(let t=0,i=n.sourceLinks.length;t0?Math.max(i.value*r,e):i.value*r}}let l=this._viewBox.y1-o+s;if(l>0){l/=a.length+1;for(let t=0,e=a.length;t1&&(l/=a.length-1,s+l>0)){s+=l;for(let t=1,e=a.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}l(this.options.nodeSortBy)&&s.sort(B2),this.resolveCollisions(s,i)}}relaxRightToLeft(t,e,i){for(let n=t.length-2;n>=0;--n){const s=t[n];for(let t=0,i=s.length;t0))continue;const a=(n/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&s.sort(B2),this.resolveCollisions(s,i)}}resolveCollisions(t,e){const i=t.length>>1,n=t[i];this.resolveCollisionsBottomToTop(t,n.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,n.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,n){for(;i1e-6&&(s.y0+=r,s.y1+=r),e=s.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,n){for(;i>=0;--i){const s=t[i],r=(s.y1-e)*n;r>1e-6&&(s.y0-=r,s.y1-=r),e=s.y0-this._gapY}}targetTop(t,e){let i,n,s,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,n=t.sourceLinks.length;i{const i=new D2(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},F2=(t,e)=>{var i;if(!t||!(null==e?void 0:e.view)||!f(t))return t;const n=e.view();if(n.x1-n.x0==0||n.y1-n.y0==0||n.x1-n.x0==-1/0||n.x1-n.x0==1/0||n.y1-n.y0==-1/0||n.y1-n.y0==1/0)return t;if(t.length>1){const e={links:[],nodes:[]};t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),t=e}else t=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData[0]:t[0];if("source"!==e.sourceField||"target"!==e.targetField)for(const i in t)if("links"===i){const n=[];t[i].forEach((t=>{const i={};for(const n in t)n===e.sourceField?i.source=t[e.sourceField]:n===e.targetField?i.target=t[e.targetField]:i[n]=t[n];n.push(i)})),t[i]=n}const s=new D2(e),r=[];return r.push(s.layout(t,n)),r},j2=t=>{var e,i;return t&&f(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:[]},z2=t=>{var e,i;return t&&f(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 H2 extends uQ{getDefaultTooltipPattern(t,e){if("mark"===t)return{visible:!0,activeType:t,title:{key:void 0,value:t=>{if(t.source){if(y(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum[this.series.getSpec().categoryField]},hasShape:!1},content:[{key:this.contentKeyCallback,value:t=>t.value,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:t=>this.contentShapeColorCallback(t),shapeHollow:!1}]};if("dimension"===t&&e){const i={key:void 0,value:this._getDimensionData,hasShape:!1},n=[];return e.forEach((({data:t})=>t.forEach((({series:t})=>{n.push({seriesId:t.id,key:this.contentKeyCallback,value:this.contentValueCallback,hasShape:!0,shapeType:this.contentShapeTypeCallback,shapeColor:this.contentShapeColorCallback,shapeHollow:!1})})))),{visible:!0,activeType:t,title:i,content:n}}return null}}class N2 extends NZ{constructor(){super(...arguments),this.type=N2.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}_initProduct(t){pW("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(rG).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),YW("linkPathGrowIn",aG),YW("linkPathGrowOut",oG),YW("linkPathUpdate",lG);const e=this.getVGrammarView(),i=this.getProductId(),n=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:n}),this._compiledProductId=i}}N2.type=Hh.linkPath,pZ.useMark([HQ,N2,EQ]),oV("sankey",{transform:L2,markPhase:"beforeJoin"},!0);class V2 extends kQ{constructor(){super(...arguments),this.type=Fh.sankey,this._nodeLayoutZIndex=PK.Node,this._labelLayoutZIndex=PK.Label,this._viewBox=new Xt,this._handleAdjacencyClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeAdjacencyClick(e):e&&e.mark.id().includes("link")?this._handleLinkAdjacencyClick(e):this._handleClearEmpty()},this._handleRelatedClick=t=>{const e=t.item;e&&e.mark.id().includes("node")?this._handleNodeRelatedClick(e):e&&e.mark.id().includes("link")?this._handleLinkRelatedClick(e):this._handleClearEmpty()},this._handleClearEmpty=()=>{const t=this._nodeMark.getProduct();if(!t||!t.elements||!t.elements.length)return;const e=t.elements,i=this._linkMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements;e.forEach((t=>{t.clearStates()})),n.forEach((t=>{t.clearStates()}))},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];[this._linkMark].forEach((t=>{const n=t.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach(((t,n)=>{t.clearStates();const s=t.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(V(s[r]).includes(e.key)){let n;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const t=s.datum,i=t?t.filter((t=>t.parents.some((t=>t.key===e.key)))).reduce(((t,e)=>t+e.value),0):0;n=i/s.value}t.addState("selected",{ratio:n})}else s.target===e.key?i.includes(s.source)||i.push(s.source):t.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];[this._linkMark].forEach((n=>{const s=n.getProduct();if(!s||!s.elements||!s.elements.length)return;s.elements.forEach((n=>{n.clearStates();const s=n.getDatum(),r=(null==s?void 0:s.parents)?"parents":"source";if(s.source===e.target||V(s[r]).includes(e.source)&&V(s[r]).includes(e.target)){let t;if(i.includes(s.source)||i.push(s.source),i.includes(s.target)||i.push(s.target),"parents"===r){const i=s.datum,n=i?i.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0):0;t=n/s.value}n.addState("selected",{ratio:t})}else n===t||n.useStates(["blur"])}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),n=this._nodeMark.getProduct();if(!n||!n.elements||!n.elements.length)return;const s=n.elements,r=this._linkMark.getProduct();if(!r||!r.elements||!r.elements.length)return;const a=r.elements;if("source"===((null===(e=a[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[i.key],e=[];a.forEach(((n,r)=>{var a,o,l,h;n.clearStates();const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(V(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].forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach(((t,i)=>{var n;t.clearStates(),e.includes(null!==(n=t.getDatum().key)&&void 0!==n?n:t.getDatum().index)?t.useStates(["selected"]):t.useStates(["blur"])}))})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(V(e.datum).forEach((e=>{const n=e.parents,s=n.length;for(let r=0;rt.source===s&&t.target===a));l?l.value+=o:t.push({source:s,target:a,value:o})}})),t)),[]);a.forEach(((n,s)=>{n.clearStates();const r=n.getDatum(),a=(null==r?void 0:r.parents)?"parents":"source",o=r.datum,l=o?o.filter((t=>t[a].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===r.source&&t.target===r.target));if(l&&l.length){t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/r.value;return n.useStates(["selected"]),void n.addState("selected",{ratio:i})}if(h)return t.includes(r.source)||t.push(r.source),t.includes(r.target)||t.push(r.target),n.useStates(["selected"]),void n.addState("selected",{ratio:h.value/r.value});n.useStates(["blur"])})),[this._nodeMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))})),[this._labelMark].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((e=>{e.clearStates(),t.includes(e.getDatum().key)||e.useStates(["blur"])}))}))}},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProduct();if(!i||!i.elements||!i.elements.length)return;const n=i.elements,s=this._linkMark.getProduct();if(!s||!s.elements||!s.elements.length)return;const r=s.elements;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source"))[this._linkMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._nodeMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates()}))}));else{const e=t.getDatum(),i=[e.source,e.target],s=[];V(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let n=0;nt.source===i&&t.target===r));s.push({source:e[n].key,target:e[n+1].key,value:t.value}),o?o.value+=a:s.push({source:i,target:r,value:a})}})),r.forEach((t=>{t.clearStates();const n=t.getDatum(),r=n.datum;if(n.source===e.source&&n.target===e.target)return t.useStates(["selected"]),void t.addState("selected",{ratio:1});const a=r?r.filter(((t,i)=>t.parents.some((n=>{var s;return n.key===e.target&&(null===(s=t.parents[i-1])||void 0===s?void 0:s.key)===e.source})))):null;if(a&&a.length){i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target);const s=a.filter((t=>t.parents.some(((i,n)=>{var s;return i.key===e.source&&(null===(s=t.parents[n+1])||void 0===s?void 0:s.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/n.value;return t.useStates(["selected"]),void t.addState("selected",{ratio:r})}const o=s.find((t=>t.source===n.source&&t.target===n.target));if(o)return i.includes(n.source)||i.push(n.source),i.includes(n.target)||i.push(n.target),t.useStates(["selected"]),void t.addState("selected",{ratio:o.value/n.value});t.useStates(["blur"])})),n.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])})),[this._labelMark].forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach((t=>{t.clearStates(),i.includes(t.getDatum().key)||t.useStates(["blur"])}))}))}}}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(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField),this._labelLimit=null!==(i=null===(e=this._spec.label)||void 0===e?void 0:e.limit)&&void 0!==i?i:100}initData(){var t,e,i,n,s,r;if(super.initData(),this._viewDataFilter){hq(this._dataSet,"sankey",F2),this.addViewDataFilter({type:"sankey",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,direction:this._spec.direction,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!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,minLinkHeight:this._spec.minLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer}});const a=new uo;cq(a,"dataview",lo),hq(a,"sankeyNodes",j2),hq(a,"addVChartProperty",nQ),hq(a,"flatten",T0);const o=new go(a);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}}}),o.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(s=this._data)||void 0===s||s.getDataView().target.addListener("change",o.reRunAllTransform),this._nodesSeriesData=new vQ(this._option,o);const l=new uo;cq(l,"dataview",lo),hq(l,"sankeyLinks",z2),hq(l,"addVChartProperty",nQ);const h=new go(l);h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:xQ.bind(this)}},!1),null===(r=this._data)||void 0===r||r.getDataView().target.addListener("change",h.reRunAllTransform),this._linksSeriesData=new vQ(this._option,h)}}initMark(){var t;const e=this._createMark(V2.mark.node,{isSeriesMark:!0,key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});e&&(e.setZIndex(this._nodeLayoutZIndex),this._nodeMark=e);const i=this._createMark(V2.mark.link,{key:gK,dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId()});if(i&&(this._linkMark=i),null===(t=this._spec.label)||void 0===t?void 0:t.visible){const t=this._createMark(V2.mark.label,{key:gK,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId()});t&&(this._labelMark=t)}}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle(),this._initLabelMarkStyle()}_initNodeMarkStyle(){var t;const e=this._nodeMark;e&&(this.setMarkStyle(e,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1,fill:t=>{var e,i,n,s,r;const a=null!==(i=null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField])&&void 0!==i?i:"";return null!==(r=null===(s=null===(n=this._spec.node)||void 0===n?void 0:n.style)||void 0===s?void 0:s.fill)&&void 0!==r?r:this.getNodeOrdinalColorScale(a)}},rZ.STATE_NORMAL,yK.Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.source)},direction:null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"},rZ.STATE_NORMAL,yK.Series),this._trigger.registerMark(i),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(i))}_initLabelMarkStyle(){var t;this._labelMark&&("vertical"===this._spec.direction?"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>t.y1>=this._viewBox.y2?t.y0:t.y1,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"center",textBaseline:t=>t.y1>=this._viewBox.y2?"bottom":"top"},rZ.STATE_NORMAL,yK.Series):"inside-start"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-middle"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"center",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"inside-end"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:"#ffffff",text:t=>this._createText(t),limit:t=>{var e;return null!==(e=this._spec.label.limit)&&void 0!==e?e:t.x1-t.x0},textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"left"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x0,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"right",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):"right"===this._spec.label.position?this.setMarkStyle(this._labelMark,{x:t=>t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series):this.setMarkStyle(this._labelMark,{x:t=>t.x1>=this._viewBox.x2?t.x0:t.x1,y:t=>(t.y0+t.y1)/2,fill:t=>{var e,i,n;return null!==(n=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==n?n:this.getNodeOrdinalColorScale(t.key)},text:t=>this._createText(t),limit:this._labelLimit,textAlign:t=>t.x1>=this._viewBox.x2?"right":"left",textBaseline:"middle"},rZ.STATE_NORMAL,yK.Series),this._labelMark.setZIndex(this._labelLayoutZIndex),this._trigger.registerMark(this._labelMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._labelMark))}_createText(t){var e;if(l(t)||l(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";return(null===(e=this._spec.label)||void 0===e?void 0:e.formatMethod)&&(i=this._spec.label.formatMethod(i,t.datum)),i}initAnimation(){var t,e;const i={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)}},n=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(qJ($J.sankeyNode(i,n),ZJ(jh.node,this._spec))),this._linkMark&&this._linkMark.setAnimationConfig(qJ($J.sankeyLinkPath(),ZJ(jh.link,this._spec))),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec)))}initEvent(){var t,e,i,n,s,r,a,o;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this)),(null===(i=this._spec.emphasis)||void 0===i?void 0:i.enable)&&"adjacency"===(null===(n=this._spec.emphasis)||void 0===n?void 0:n.effect)&&("hover"===(null===(s=this._spec.emphasis)||void 0===s?void 0:s.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleAdjacencyClick):this.event.on("pointerdown",{level:uK.mark},this._handleAdjacencyClick)),(null===(r=this._spec.emphasis)||void 0===r?void 0:r.enable)&&"related"===(null===(a=this._spec.emphasis)||void 0===a?void 0:a.effect)&&("hover"===(null===(o=this._spec.emphasis)||void 0===o?void 0:o.trigger)?this.event.on("pointerover",{level:uK.mark},this._handleRelatedClick):this.event.on("pointerdown",{level:uK.mark},this._handleRelatedClick))}nodesSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._nodesSeriesData.updateData()}linksSeriesDataUpdate(){this.event.emit(cK.legendFilter,{model:this}),this._linksSeriesData.updateData()}initTooltip(){this._tooltipHelper=new H2(this)}getNodeOrdinalColorScale(t){var e,i,n,s,r,a,o;const l=(null===(e=this._rawData.latestData[0])||void 0===e?void 0:e.nodes)?(null===(i=this._rawData.latestData[0].nodes[0])||void 0===i?void 0:i.children)?Array.from(this.extractNamesFromTree(this._rawData.latestData[0].nodes)):this._rawData.latestData[0].nodes.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)):null===(n=this._rawData.latestData[0])||void 0===n?void 0:n.values.map(((t,e)=>this._spec.nodeKey?t[this._spec.categoryField]:e)),h=null!==(r=null===(s=this._option.globalScale.color)||void 0===s?void 0:s.range())&&void 0!==r?r:dh(this._option.getTheme().colorScheme,this.type),c=new mh;return null===(o=(a=c.domain(l)).range)||void 0===o||o.call(a,h),c.scale(t)}extractNamesFromTree(t){const e=new Set;return t.forEach((t=>{if(e.add(t.name),t.children){this.extractNamesFromTree(t.children).forEach((t=>e.add(t)))}})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getSeriesKeys(){var t;if(this._seriesField){const e=[];return null===(t=this._nodesSeriesData)||void 0===t||t.getDataView().latestData.forEach((t=>{var i;e.push(null!==(i=t[this._seriesField])&&void 0!==i?i:t.datum[this._seriesField])})),e}return[]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform(),this._nodesSeriesData.updateData(),this._linksSeriesData.updateData()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}}V2.type=Fh.sankey,V2.mark=hc,pZ.useSeries([V2]);class W2 extends LQ{constructor(){super(...arguments),this.type=jQ.sankey,this.seriesType=Fh.sankey}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,minLinkHeight:t.minLinkHeight,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}W2.type=jQ.sankey,W2.view="singleDefault";const G2=[10,20],U2=al.Linear,Y2="circle",X2=al.Ordinal,$2=["circle","square","triangle","diamond","star"];pZ.useMark([RQ,EQ]);class K2 extends kQ{constructor(){super(...arguments),this.type=Fh.scatter}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:n},s){if(o(e))return e;if(f(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;if(e.length>2)return this._option.onError(`${s} length is invalid, specify up to 2 ${s}s.`),e;const n=`${IN}_series_scatter_${this.id}_scale_${s}`;return this._option.globalScale.registerModelScale({id:n,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:n,field:t}}if(c(e)){if(l(t))return this._option.onError(`${s}Field is required.`),e;const r=`${IN}_series_scatter_${this.id}_scale_${s}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:n},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return this._option.onError(`${s} attribute is invalid.`),e}getSizeAttribute(t,e){return l(e)?10:y(e)?e:!g(e)||("string"!=typeof(i=e)||isNaN(Number(i))||isNaN(parseFloat(i)))?this._getSeriesAttribute(t,e,{defaultScaleType:U2,defaultRange:G2},"size"):parseFloat(e);var i}getShapeAttribute(t,e){return l(e)?Y2:g(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:X2,defaultRange:$2},"shape")}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._symbolMark=this._createMark(K2.mark.point,{morph:tQ(this._spec.animation,this._spec.morph,ZJ("point",this._spec)),defaultMorphElementKey:this.getDimensionField()[0],groupKey:this._seriesField,label:Lh({animation:this._spec.animation},this._spec.label),progressive:t,isSeriesMark:!0})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e;const i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(qJ($J.scatter({},i),ZJ(jh.point,this._spec)))}initSymbolMarkStyle(){var t;const e=this._symbolMark;e&&("zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined}),this.setMarkStyle(e,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:y(this._size)||o(this._size)?this._size:10,symbolType:g(this._shape)||o(this._shape)?this._shape:Y2},rZ.STATE_NORMAL,yK.Series),(h(this._sizeField)||h(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},rZ.STATE_NORMAL,yK.User_Mark),(h(this._shapeField)||h(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},rZ.STATE_NORMAL,yK.User_Mark),this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e))}viewDataStatisticsUpdate(t){var e,i,n;super.viewDataStatisticsUpdate(t),"zero"===this._invalidType||(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this.getStackValueField()])||void 0===n?void 0:n.allValid)?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",yK.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined},"normal",yK.Series)}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},rZ.STATE_NORMAL,yK.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined},rZ.STATE_NORMAL,yK.Series))}handleZoom(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}handlePan(t){this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),n=t.getDatum(),s=this.dataToPosition(n);s&&i&&i.translateTo(s.x,s.y)}))}))}getDefaultShapeType(){return"circle"}}K2.type=Fh.scatter,K2.mark=Yh,pZ.useSeries([K2]);class q2 extends FQ{constructor(){super(...arguments),this.type=jQ.scatter,this.seriesType=Fh.scatter}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}q2.type=jQ.scatter,q2.view="singleDefault";class Z2 extends uQ{getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"link info",value:"link info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"time",value:t=>fo.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"type",value:t=>t.action_type},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"from",value:t=>t.from},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"to",value:t=>t.to}]}:null}}pZ.useMark([s1,RQ]);class J2 extends kQ{constructor(){super(...arguments),this.type=Fh.link}getFromField(){return this._fromField}setFromField(t){h(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){h(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){h(t)&&(this._dotSeriesSpec=t)}initData(){var t;super.initData();hq(this._option.dataSet,"linkDotInfo",((t,e)=>{const i=this._spec.data.latestData,n=this._spec.dataDot.latestData,s={};return n.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const n=t[e];null==n||n.forEach((t=>{s[t.node_name]=Object.assign({},i,t)}))})),i.forEach((t=>{var e,i,n,r;t[this._fromField+"_xField"]=null===(e=null==s?void 0:s[t[this._fromField]])||void 0===e?void 0:e[this._dotSeriesSpec.xField],t[this._fromField+"_yField"]=null===(i=null==s?void 0:s[t[this._fromField]])||void 0===i?void 0:i[this._dotSeriesSpec.yField],t[this._toField+"_xField"]=null===(n=null==s?void 0:s[t[this._toField]])||void 0===n?void 0:n[this._dotSeriesSpec.xField],t[this._toField+"_yField"]=null===(r=null==s?void 0:s[t[this._toField]])||void 0===r?void 0:r[this._dotSeriesSpec.yField]})),i})),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"linkDotInfo",options:"dots"},!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(J2.mark.group),this._containerMark=this._createMark(J2.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(J2.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(J2.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,n,s,r;const a=this._clipMark;a&&(this.setMarkStyle(a,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),a.setInteractive(!1));const o=this._containerMark;o&&(this.setMarkStyle(o,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",yK.Series),o.setInteractive(!1));const l=this._linkMark;l&&(this.setMarkStyle(l,{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",yK.Series),this._trigger.registerMark(l),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(l));const h=this._arrowMark;if(h){const t=null!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.arrow)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size)&&void 0!==s?s:10;this.setMarkStyle(h,{x:this.dataToPositionXTo.bind(this),y:e=>this.dataToPositionArrowYTo(e,t),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:t,symbolType:t=>this.isPositionYFromHigher(t)?zK.triangleDown:zK.triangleUp},"normal",yK.Series),this._trigger.registerMark(h),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(h)}}afterInitMark(){super.afterInitMark(),this._trigger.setStateKeys([this._seriesField,this._fromField])}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,n=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+n}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)n(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}initTooltip(){this._tooltipHelper=new Z2(this)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}}J2.type=Fh.link,J2.mark=tc;class Q2 extends uQ{updateTooltipSpec(){var t;super.updateTooltipSpec(),h(null===(t=this.spec)||void 0===t?void 0:t.mark)&&(this.spec.mark.updateContent=(t,e,i)=>{const n=[],s=t.filter((t=>"children"===t.key));return s.length>0&&s[0].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)})}getDefaultTooltipPattern(t){return"mark"===t?{visible:!0,activeType:t,title:{key:"event info",value:"event info"},content:[{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:t=>t.type,value:t=>t.id},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"event_time",value:t=>fo.getInstance().timeFormat("%Y%m%d",t.event_time)},{hasShape:!0,shapeType:"square",shapeColor:this.contentShapeColorCallback,key:"action_type",value:t=>t.action_type},{shapeType:"square",hasShape:!0,shapeColor:this.contentShapeColorCallback,key:"children",value:t=>t.children}],updateContent:(t,e,i)=>{const n=[];return t[3].value.forEach((t=>{let i=!0;for(const s in t)n.push({shapeType:"circle",hasShape:i,shapeColor:this.contentShapeColorCallback(e[0].datum[0]),key:s,value:t[s]+""}),i=!1})),t.concat(n)}}:null}}const t3=(t,e)=>{const i=t[0].latestData?t[0].latestData:t||[],n=[];return i.forEach((t=>{const i={};for(const n in t)n!==e&&(i[n]=t[n]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},e3={fill:"#bbb",fillOpacity:.2};pZ.useMark([RQ,EQ,s1,HQ]);class i3 extends kQ{constructor(){super(...arguments),this.type=Fh.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){h(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){h(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){h(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){h(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){h(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){h(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),hq(this._option.dataSet,"objFlat",t3),hq(this._option.dataSet,"copyDataView",fq),cq(this._option.dataSet,"dataview",lo),null===(t=this.getViewDataFilter())||void 0===t||t.transform({type:"objFlat",options:"dots"},!1)}setSeriesField(t){h(t)&&(this._seriesField=t,this.getMarksInType([Hh.line,Hh.area]).forEach((t=>{t.setFacet(this._seriesField)})))}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain},{key:this._fieldX[0],operations:["max","min"]}]}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setSeriesGroupField(this._spec.seriesGroupField),this.setTitleField(this._spec.titleField),this.setSubTitleField(this._spec.subTitleField),this.setDotTypeField(this._spec.dotTypeField),this.setHighLightSeriesGroup(this._spec.highLightSeriesGroup),this.setGridBackground(Lh(e3,(null===(e=null===(t=this._spec)||void 0===t?void 0:t.grid)||void 0===e?void 0:e.background)||{}))}initMark(){this._clipMark=this._createMark(i3.mark.group),this._containerMark=this._createMark(i3.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(i3.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(i3.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(i3.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(i3.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(i3.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(i3.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight,clip:!0},"normal",yK.Series),e.setInteractive(!1));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",yK.Series),i.setInteractive(!1));const n=this._gridBackgroundMark;n&&(this.setMarkStyle(n,{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",yK.Series),this._trigger.registerMark(n));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",yK.Series),this._trigger.registerMark(s));const r=this._dotMark;r&&(this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",yK.Series),this._trigger.registerMark(r),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(r));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",yK.Series),this._trigger.registerMark(a));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",yK.Series),this._trigger.registerMark(o));const l=this._symbolMark;l&&(this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",yK.Series),this._trigger.registerMark(l))}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,n,s;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!==(s=null===(n=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==s?s:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this._viewDataStatistics)||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:vK}}getDotColorScale(){var t,e,i;const n=this._dotTypeField?null===(t=this._viewDataStatistics)||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this._viewDataStatistics)||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this._viewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField].values:[],s=dh(this._option.getTheme().colorScheme,this.type);return(new mh).domain(n).range(s)}getDotColorAttribute(){var t,e,i,n;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(n=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==n?n:vK}}initTooltip(){this._tooltipHelper=new Q2(this)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}}i3.type=Fh.dot,i3.mark=ec,pZ.useSeries([i3,J2]);class n3 extends LQ{constructor(){super(...arguments),this.type=jQ.sequence}transformSpec(t){var e,i,n,s,r;super.transformSpec(t);let a=0;const o=[],l=[],h=[],c=[],d=t.series.filter((t=>t.type!==Fh.link)).length,u=(this._layoutRect.height-20*(d-1))/d,p=(null===(e=null==t?void 0:t.appendPadding)||void 0===e?void 0:e.left)||0,g=(null===(i=null==t?void 0:t.appendPadding)||void 0===i?void 0:i.right)||0;(null==t?void 0:t.legends)&&(o.push({modelId:`legendRow${a}`,col:1,row:a}),t.legends[0].id=`legendRow${a}`,c.push({index:a,size:20}),a++),(null==t?void 0:t.dataZoom)&&(o.push({modelId:`dataZoomRow${a}`,col:1,row:a}),t.dataZoom[0].id=`dataZoomRow${a}`,a++,c.push({index:a,size:10}),a++),l.push({id:`regionAxesRow${a}`}),o.push({modelId:`axesRow${a}`,col:1,row:a}),t.axes[0].id=`axesRow${a}`,t.axes[0].regionIndex=Array.from(Array(this._spec.series.length-1),((t,e)=>e+1)),a++,null===(n=null==t?void 0:t.series)||void 0===n||n.forEach((t=>{var e,i;[Fh.bar,Fh.line,Fh.area,Fh.dot].includes(t.type)&&(o.push({modelId:`${t.type}Row${a}`,col:1,row:a}),o.push({modelId:`axesLeftRow${a}`,col:0,row:a}),l.push({id:`${t.type}Row${a}`,clip:!1}),c.push({index:a,size:(null==t?void 0:t.height)||u}),h.push({orient:"left",id:`axesLeftRow${a}`,type:t.type===Fh.dot?"band":"linear",visible:t.type!==Fh.dot,title:{visible:!0,autoRotate:!1,style:{text:null==t?void 0:t.barTitle,dx:-20,textBaseline:"middle",textAlign:"end"}},grid:{visible:"boolean"!=typeof(null===(e=null==t?void 0:t.grid)||void 0===e?void 0:e.visible)||(null===(i=null==t?void 0:t.grid)||void 0===i?void 0:i.visible),style:(e,i)=>{var n,s,r,a,o;let l=0;if(0===i){const e=null===(n=null==t?void 0:t.grid)||void 0===n?void 0:n.style;l=null!==(r=null!==(s=null==e?void 0:e.lineWidth)&&void 0!==s?s:null==e?void 0:e.strokeWidth)&&void 0!==r?r:1}return{lineWidth:l,stroke:(null===(o=null===(a=null==t?void 0:t.grid)||void 0===a?void 0:a.style)||void 0===o?void 0:o.stroke)||"#dfdfdf",lineDash:[0,0]}}},domainLine:{visible:!1},tick:{visible:!1},label:{visible:!1},regionIndex:l.length-1}),t.regionIndex=l.length-1,a++,c.push({index:a,size:(null==t?void 0:t.padding)||20}),a++,t.leftAppendPadding=p,t.type===Fh.dot&&(t.title.style.dx=-p,t.subTitle.style.dx=-p))})),null===(s=null==t?void 0:t.series)||void 0===s||s.forEach((e=>{if(e.type===Fh.link){const i=e.dotSeriesIndex+1;o.push({modelId:`${e.type}Row${i}`,col:1,row:i-1}),e.regionIndex=t.series[e.dotSeriesIndex].regionIndex,e.leftAppendPadding=p,e.height=t.series[e.dotSeriesIndex].height,e.clipHeight=t.series[e.dotSeriesIndex].clipHeight}})),(null==t?void 0:t.legends)&&(t.legends[0].regionIndex=[l.length-1]);const f={type:"grid",col:3,row:a,colWidth:[{index:0,size:p},{index:2,size:g}],rowHeight:c,elements:o};t.layout=f,t.region=l,null===(r=t.axes)||void 0===r||r.push(...h)}createSeries(t){t.forEach(((t,e)=>{let i;if(t.data?(t.data=mq(t.data,this._dataSet,this._spec.data,{onError:this._option.onError}),t.type===Fh.link&&(t.dataDot=mq(this._spec.series[t.dotSeriesIndex].data,this._dataSet,this._spec.data,{onError:this._option.onError}))):(t.data=this.getSeriesData(t.dataId,t.dataIndex),t.type===Fh.link&&(t.dataDot=this.getSeriesData(this._spec.series[t.dotSeriesIndex].dataId,this._spec.series[t.dotSeriesIndex].dataIndex))),t.type===Fh.link&&(t.dotSeriesSpec=this._spec.series[t.dotSeriesIndex]),t.regionId&&(i=this.getRegionsInUserId(t.regionId)),i||(i=this.getRegionsInIndex(t.regionIndex?[t.regionIndex]:void 0)[0]),!i)return;const n=BN.createSeries(t.type,t,Object.assign(Object.assign({},this._modelOption),{region:i,specIndex:e,specKey:"series",getTheme:()=>this._theme,globalScale:this._globalScale}));n&&(n.created(),this._series.push(n),i.addSeries(n))}))}}n3.type=jQ.sequence,n3.view="singleDefault";const s3=(t,e)=>{if(!t)return t;const i=e(),{width:n,height:s}=i;return new h0(i).layout(t,{width:n,height:s})};class r3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}pZ.useMark([F0,EQ]);class a3 extends c1{constructor(){super(...arguments),this.type=Fh.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:yQ),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:fK},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"sunburstLayout",s3),hq(this._dataSet,"flatten",T0),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:n}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[h(this._centerX)?this._centerX:this.getLayoutRect().width/2,h(this._centerY)?this._centerY:this.getLayoutRect().height/2],startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:t,outerRadius:e,gapRadius:i,label:n}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();l(null==t?void 0:t.dataSet)||(hq(t.dataSet,"addVChartProperty",nQ),t.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t;if(!1===this._sunburst.visible)return;const e=this._createMark(a3.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=e,this._trigger.registerMark(this._sunburstMark),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(this._sunburstMark)}_initArcMarkStyle(){l(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(h(this._offsetX)?this._offsetX:0),y:t=>t.y+(h(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},rZ.STATE_NORMAL,yK.Series)}_initLabelMark(){var t;if(!0!==this._label.visible)return;const e=this._createMark(a3.mark.label,{isSeriesMark:!1});this._labelMark=e,this._trigger.registerMark(e),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(e)}_initLabelMarkStyle(){l(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return c(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)+(h(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(h(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},rZ.STATE_NORMAL,yK.Series)}initTooltip(){this._tooltipHelper=new r3(this)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(V(this.__innerRadius))[0],outerRadius:this._computeRadius(V(this.__outerRadius))[0],startAngle:V(this._startAngle)[0],endAngle:V(this._endAngle)[0]})},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType(Hh.arc).forEach((t=>{t.setAnimationConfig(qJ($J.sunburst(i,n),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){if(f(t))return t.map((t=>{const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*t}));const{width:e,height:i}=this.getRegion().getLayoutRect();return Math.min(e/2,i/2)*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""}setValueFieldToStack(){}setValueFieldToPercent(){}_noAnimationDataKey(t,e){}}a3.type=Fh.sunburst,a3.mark=uc,N(a3,D0),pZ.useSeries([a3]);class o3 extends LQ{constructor(){super(...arguments),this.type=jQ.sunburst,this.seriesType=Fh.sunburst}getDefaultSeriesSpec(t){const e=h(t.startAngle)?t.startAngle:iV,i=h(t.endAngle)?t.endAngle:e+qt(2*Math.PI),n=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),s=Fh.sunburst;return n.type=s,n[s]=t[s],n}transformSpec(t){super.transformSpec(t);const e=this.getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}o3.type=jQ.sunburst,o3.view="singleDefault";const l3=(t,e)=>{if(!t||!(null==e?void 0:e.range))return t;const i=e.range();if(i.x1-i.x0==0||i.y1-i.y0==0)return t;return new o0(e).layout(t,i)},h3=(t,e)=>{let i={},n=e.fields;if(o(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const s=t[0].latestData,r=T0(s);return i=gQ([{latestData:r}],e),i};class c3 extends uQ{constructor(){super(...arguments),this.contentKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}get defaultShapeType(){return"square"}}class d3{initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,I0[this._renderMode]&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getTriggerEvent("trigger")))}_getTriggerEvent(t){return I0[this._renderMode][t]}_bindZoomEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearZoom()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const n=t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:s,zoomX:r,zoomY:a}=n;l(s)||wh({x:r,y:a},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({zoomDelta:s,zoomX:r,zoomY:a},n),this._eventObj.emit("zoom",{scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY},model:this}))}))}initZoomEventOfSeries(t,e){I0[this._renderMode]&&this._bindZoomEventAsRegion(t.event,t,e)}initZoomEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i)})):this._bindZoomEventAsRegion(this._eventObj,t,i)}))}initScrollEventOfSeries(t,e){I0[this._renderMode]&&this._bindScrollEventAsRegion(t.event,t,e)}initScrollEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i)})):this._bindScrollEventAsRegion(this._eventObj,t,i)}))}_bindScrollEventAsRegion(t,e,i){t.on(this._getTriggerEvent("scrollEnd"),{level:uK.chart,consume:!1},(t=>{this._zoomableTrigger.clearScroll()})),t.on(this._getTriggerEvent("scroll"),{level:uK.chart,consume:!0},(t=>{if(!t.event)return;const{event:n}=t;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:s,scrollY:r}=n;l(s)&&l(r)||wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&(this._clickEnable=!1,i&&i({scrollX:s,scrollY:r},n),this._eventObj.emit("scroll",{scrollX:s,scrollY:r,model:this}))}))}_bindDragEventAsRegion(t,e,i){t.on(this._getTriggerEvent("start"),{level:uK.chart},(t=>{if(!t.event)return;const{event:n}=t;wh({x:n.canvasX,y:n.canvasY},Object.assign(Object.assign({},e.getLayoutRect()),e.getLayoutStartPoint()))&&this._handleDrag(t,i)})),t.on("click",{level:uK.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e){I0[this._renderMode]&&t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e)}))}initDragEventOfRegions(t,e,i){I0[this._renderMode]&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getTriggerEvent("start"),{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:uK.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i)}))}_handleDrag(t,e){if(this._clickEnable=!0,!this._zoomableTrigger.parserDragEvent(t.event))return;const i=this._getTriggerEvent("move"),n=this._getTriggerEvent("end"),s=t.event;let r=s.canvasX,a=s.canvasY;const o=()=>{this._zoomableTrigger.pointerId=null,this._eventObj.off(i,{level:uK.chart,source:dK.chart},l),this._eventObj.off(n,{level:uK.chart,source:dK.window},o)},l=t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1;const i=t.event,n=[i.canvasX-r,i.canvasY-a];r=i.canvasX,a=i.canvasY,e&&e(n,t.event),this._eventObj.emit("panmove",{delta:n,model:this})};this._eventObj.on(i,{level:uK.chart,source:dK.chart},l),this._eventObj.on(n,{level:uK.chart,source:dK.chart},o)}}pZ.useMark([HQ,EQ]);class u3 extends kQ{constructor(){super(...arguments),this.type=Fh.treemap,this._viewBox=new Xt,this._clickEnable=!0,this._enableAnimationHook=this.enableMarkAnimation.bind(this)}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:yQ),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new ee),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:fK},getRawData:()=>this.getRawData()}),_(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,n;super.initData(),this._viewDataFilter&&(this._spec.drill&&this.initDrillableData(this._dataSet),hq(this._dataSet,"treemap",l3),hq(this._dataSet,"flatten",T0),this.addViewDataFilter({type:"treemap",options:{range:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(t=this._spec.nonLeafLabel)||void 0===t?void 0:t.visible)?null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.padding:0,labelPosition:null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize}}),this.addViewDataFilter({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(hq(this._rawData.dataSet,"addVChartProperty",nQ),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bQ,call:SQ.bind(this)}}))}_statisticRawData(){const t=`${IN}_series_${this.id}_rawDataStatic`;this._rawDataStatistics=this._createHierarchyDataStatistics(t,[this._rawData]),this._rawData.target.removeListener("change",this._rawDataStatistics.reRunAllTransform),this._rawDataStatistics.reRunAllTransform()}_createHierarchyDataStatistics(t,e){hq(this._dataSet,"hierarchyDimensionStatistics",h3),hq(this._dataSet,"flatten",T0);const i=new go(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:mQ,operations:["max","min","values"]},{key:yQ,operations:["values"]}])}initMark(){var t,e,i,n,s,r;const a=this._createMark(u3.mark.nonLeaf,{isSeriesMark:!0});a&&(a.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._trigger.registerMark(a),this._nonLeafMark=a,null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(a));const o=this._createMark(u3.mark.leaf,{isSeriesMark:!0});if(o&&(o.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=o,this._trigger.registerMark(o),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(o)),null===(i=this._spec.label)||void 0===i?void 0:i.visible){const t=this._createMark(u3.mark.label,{skipBeforeLayouted:!1});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._labelMark=t,this._trigger.registerMark(t),null===(n=this._tooltipHelper)||void 0===n||n.activeTriggerSet.mark.add(t))}if(null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.visible){const t=this._createMark(u3.mark.nonLeafLabel);t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafLabelMark=t,this._trigger.registerMark(t),null===(r=this._tooltipHelper)||void 0===r||r.activeTriggerSet.mark.add(t))}}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle(),this._initLabelMarkStyle(),this._initNonLeafLabelMarkStyle()}_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()},rZ.STATE_NORMAL,yK.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()},rZ.STATE_NORMAL,yK.Series)}_initLabelMarkStyle(){this._labelMark&&this.setMarkStyle(this._labelMark,{visible:(t,e,{element:i})=>{if(!t.isLeaf)return!1;const n=i.getBounds(),{y0:s,y1:r}=t;return!!n&&n.y1>s&&n.y2(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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}_initNonLeafLabelMarkStyle(){this._nonLeafLabelMark&&this.setMarkStyle(this._nonLeafLabelMark,{visible:t=>!!t.labelRect,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]]},limit:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},rZ.STATE_NORMAL,yK.Series)}initAnimation(){this.getMarksInType(Hh.rect).forEach((t=>{t.setAnimationConfig(qJ($J.treemap(),ZJ(t.name,this._spec)))})),this.getMarksInType(Hh.text).forEach((t=>{t.setAnimationConfig(qJ($J.label(),ZJ(t.name,this._spec)))}))}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 c3(this)}_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:n,c:s,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,n,s,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:n,y:s}=i;this._matrix.translate(n,s),this._matrix.scale(e,e),this._matrix.translate(-n,-s);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(NV.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this.reFilterViewData()}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._rawData.reRunAllTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),this.event.off(NV.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()}))}getDefaultShapeType(){return"square"}}u3.type=Fh.treemap,u3.mark=lc,N(u3,d3),N(u3,D0),pZ.useSeries([u3]);class p3 extends LQ{constructor(){super(...arguments),this.type=jQ.treemap,this.seriesType=Fh.treemap}getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);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]}}p3.type=jQ.treemap,p3.view="singleDefault";const g3=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,valueField:n,startAs:s,endAs:r,total:a,seriesField:o,seriesFieldName:h,groupData:c}=e,d=[],{dimensionValues:u,dimensionData:p}=c().latestData,g=Array.from(u[i]);let f={start:0,end:0,lastIndex:null};return g.forEach(((t,e)=>{const i={start:f.end,end:f.end,lastIndex:f.lastIndex,lastEnd:f.end,index:t,isTotal:!1};p[t].forEach((t=>{let c=!1;if(a&&"end"!==a.type){if("field"===a.type||"custom"===a.type){if(t[a.tagField])if(c=!0,"custom"===a.type){const{start:e,end:n}=a.product(t,f);t[s]=e,t[r]=n,i.end=n,i.start=e}else{let e=0,o=i.end;if(a.collectCountField&&!l(t[a.collectCountField])){const i=d.length-+t[a.collectCountField],n=d.length-1;i<0?console.warn("total.collectCountField error"):e=d[i].start,n<0?console.warn("total.collectCountField error"):o=d[n].end}else a.startField&&!l(t[a.startField])&&(e=+t[a.startField]),a.valueField&&!l(t[a.valueField])&&(o=Wt(e,+t[a.valueField]));t[s]=e,t[r]=o,t[n]=o-e,i.start=e,i.end=o}}}else e===g.length-1&&(i.start=0,t[s]=i.start,t[r]=i.end,c=!0);c||(t[s]=+i.end,t[r]=Wt(t[s],+t[n]),i.end=t[r]),i.isTotal=c,(l(o)||o===pK)&&(t[pK]=c?h.total:+t[n]>=0?h.increase:h.decrease)})),f=Object.assign(Object.assign({},i),{lastIndex:t}),d.push(i)})),d},f3=(t,e)=>{if(!t)return t;const{indexField:i,valueField:n,total:s,seriesField:r}=e,a={[i]:(null==s?void 0:s.text)||"total",[n]:t.reduce(((t,e)=>Wt(t,+e[n])),0)};return r&&(a[r]="total"),t.push(a),t},v3=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:m3(t.map((t=>t.latestData)).flat(),e.fields,i)}};function m3(t,e,i){if(0===e.length)return t;const n=e[0],s=e.slice(1);i[n]=new Set;const r=function(t,e,i){const n={};return t.forEach((t=>{const s=t[e];n[s]||(n[s]=[],i.add(s)),n[s].push(t)})),n}(t,n,i[n]);return s.length?(a=r,o=(t,e)=>m3(t,s,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class y3{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,n=new go(e instanceof uo?e:t.dataSet);n.name=i,n.parse([t],{type:"dataview"}),hq(e,"dimensionTree",v3),n.transform({type:"dimensionTree",options:{fields:this._fields}},!1),n.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=n}groupDataUpdate(){}getGroupValueInField(t){var e,i,n;const s=null===(n=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===n?void 0:n[t];return s?Array.from(s):[]}}pZ.useMark([s1]);class _3 extends NQ{constructor(){super(...arguments),this.type=Fh.waterfall,this._stack=!0,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new y3(t),this._data&&this._groups.initData(this._data.getDataView(),this._dataSet))}setAttrFromSpec(){super.setAttrFromSpec(),this._stack=!1,this._fieldX=[this._fieldX[0]],this._fieldY=[this._fieldY[0]],l(this._seriesField)&&(this._seriesField=pK)}getSeriesKeys(){return this._seriesField===pK?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),hq(this._dataSet,"waterfallFillTotal",f3),hq(this._dataSet,"waterfall",g3),(l(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=vq(this.getViewData(),this._dataSet,{name:`${IN}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new vQ(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:_K,endAs:bK,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}initAnimation(){var t,e;const i={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)}},n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,s=t=>{var e,i,n;const s=null==t?void 0:t[this._fieldX[0]];return(null===(n=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[this._fieldX[0]])||void 0===n?void 0:n.values.indexOf(s))||0};this._rectMark.setAnimationConfig(qJ($J.waterfall(i,n),ZJ(jh.bar,this._spec),{dataIndex:s})),this._labelMark&&this._labelMark.setAnimationConfig(qJ($J.label(),ZJ(jh.label,this._spec),{dataIndex:s}))}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(_3.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()));const e=this._createMark(_3.mark.stackLabel,{key:"index"});e&&(this._stackLabelMark=e,e.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}_totalPositionX(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._xAxisHelper;return this._direction===HK.vertical?n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("width",t)*(.5-i):bh(n([t[e]],{bandPosition:this._bandPosition}))}_totalPositionY(t,e,i=.5){const{dataToPosition:n,getBandwidth:s}=this._yAxisHelper;return this._direction===HK.vertical?bh(n([t[e]],{bandPosition:this._bandPosition})):n([t[e]],{bandPosition:this._bandPosition})+.5*s(0)-this._rectMark.getAttribute("height",t)*(.5-i)}initMarkStyle(){var t,e;if(super.initMarkStyle(),this._leaderLineMark&&(this._direction===HK.vertical?this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>t.lastIndex?this._totalPositionX(t,"lastIndex",1):0,x1:t=>this._totalPositionX(t,"index",0),y:t=>this._totalPositionY(t,"lastEnd",0),y1:t=>this._totalPositionY(t,t.isTotal?"end":"start",0)},"normal",yK.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!l(t.lastIndex),x:t=>this._totalPositionX(t,"lastEnd",0),x1:t=>this._totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this._totalPositionY(t,"lastIndex",1):0,y1:t=>this._totalPositionY(t,"index",0)},"normal",yK.Series)),this._stackLabelMark){this.setMarkStyle(this._stackLabelMark,{text:t=>{var e,i;const n="absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:function(t,e){return Nt(t-e,10**Math.max(Vt(t),Vt(e)))}(t.end,t.start);return(null===(i=this._spec.stackLabel)||void 0===i?void 0:i.formatMethod)?this._spec.stackLabel.formatMethod(n,t):n}});const i=(null===(t=this._spec.stackLabel)||void 0===t?void 0:t.position)||"withChange",n=(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.offset)||0;this._direction===HK.vertical?this.setMarkStyle(this._stackLabelMark,{x:t=>this._totalPositionX(t,"index",.5),y:t=>"middle"===i?.5*(this._totalPositionY(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionY(t,t.end>=t.start?"end":"start")-n:"min"===i?this._totalPositionY(t,t.end>=t.start?"start":"end")+n:this._totalPositionY(t,"end")+(t.end>=t.start?-n:n),textBaseline:t=>"middle"===i?"middle":"withChange"===i&&t.end-t.start>=0||"max"===i?"bottom":"top"}):this.setMarkStyle(this._stackLabelMark,{x:t=>"middle"===i?.5*(this._totalPositionX(t,"end")+this._totalPositionY(t,"start")):"max"===i?this._totalPositionX(t,t.end>=t.start?"end":"start")+n:"min"===i?this._totalPositionX(t,t.end>=t.start?"start":"end")-n:this._totalPositionX(t,"end")+(t.end>=t.start?n:-n),y:t=>this._totalPositionY(t,"index",.5),textAlign:t=>"middle"===i?"center":"withChange"===i&&t.end-t.start>=0||"max"===i?"left":"right"})}}}_3.type=Fh.waterfall,_3.mark=ac,pZ.useSeries([_3]);class b3 extends VQ{constructor(){super(...arguments),this.type=jQ.waterfall,this.seriesType=Fh.waterfall}transformSpec(t){super.transformSpec(t),t.legends&&V(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),dZ(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}b3.type=jQ.waterfall,b3.view="singleDefault";class x3 extends LQ{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this.isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}const S3=[0],w3=[20,40],A3=[200,500],k3={shrink:!1,enlarge:!1,fontSizeLimitMin:0},M3=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon"],C3={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:T3,triangle:T3,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 T3(){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 E3(t,e){const i=e[0],n=e[1];let s=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(n/2.7*.6),s=Math.floor(Math.min(i/2.3,n/2.6));break;case"triangleForward":s=n/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(n/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(n/1.5),s=Math.floor(Math.min(n/1.5,i/2));break;default:s=Math.floor(Math.min(i/2,n/2))}return{maxRadius:s,center:r}}const P3=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function R3(t){return o(t)?t:function(){return t}}class O3{constructor(t){var e,i;switch(this.options=D({},O3.defaultOptions,t),o(this.options.shape)?this.shape=this.options.shape:this.shape=(t=>C3[t]?C3[t]():C3.circle())(this.options.shape),this.getText=null!==(e=R3(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=R3(this.options.fontWeight),this.getTextFontSize=R3(this.options.fontSize),this.getTextFontStyle=R3(this.options.fontStyle),this.getTextFontFamily=R3(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>P3(10,50);break;case"random-light":this.getTextColor=()=>P3(50,90);break;default:this.getTextColor=R3(this.options.color)}if(l(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=o(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:()=>{var t;return Kt(null!==(t=this.options.rotate)&&void 0!==t?t:0)}}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:0)+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:0)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndex&&this.progressiveIndex0?this.currentStepIndex=0:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.progressiveResult=[]}output(){return this.result?this.outputCallback(this.result):null}progressiveOutput(){return this.progressiveResult?this.outputCallback(this.progressiveResult):null}unfinished(){return this.data&&this.data.length&&!l(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,n=0;return t=>{const s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}};class I3 extends O3{constructor(t){var e;super(D({},I3.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<=I3.defaultOptions.minFontSize&&(this.options.minFontSize=I3.defaultOptions.minFontSize),this.spiral=g(this.options.spiral)?null!==(e=B3[this.options.spiral])&&void 0!==e?e:B3.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=R3(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:n}=E3(this.options.shape,this._size);if(e.x=n[0],e.y=n[1],function(t,e,i,n,s,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(s<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,f,v;for(--n;++n>5<<5,g=~~Math.max(Math.abs(s+r),Math.abs(s-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=s<<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 m=a.getImageData(0,0,(s<<5)/o,r/o).data,y=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,f=0;f>5),i=m[(h+v)*(s<<5)+(l+f)<<2]?1<<31-f%32:0;y[e]|=i,t|=i}t?r=v:(e.y0++,g--,v--,h++)}e.y1=e.y0+r,e.sprite=y.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],n=t[1];e.x+e.x0n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.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,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board);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(XH.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null;const n=t.length;let s=0;this.result=[];const r=t.map((t=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t),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}));this.data=r;let a=0;for(;s=2?(s++,a=0):a++,this.progressiveIndex=s,!this.exceedTime()););if(!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._size[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),n=this.dy(),s=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 n=Math.min(e.x,this._size[0]-i.x),s=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(n/this._size[0],s/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e){const i=this._size[0]*(e||1.1)-this._size[0]>>5;let n=2*i>2?i:2;n%2!=0&&n++;let s=Math.ceil(this._size[1]*(n<<5)/this._size[0]);s%2!=0&&s++;const r=this._size[0],a=this._size[1],o=new Array(n).fill(0),l=new Array(s/2*(n+(r>>5))).fill(0);this.insertZerosToArray(t,a*(r>>5),l.length+n/2);for(let e=a-1;e>0;e--)this.insertZerosToArray(t,e*(r>>5),o.length);this.insertZerosToArray(t,0,l.length+n/2),this._size=[r+(n<<5),a+s]}insertZerosToArray(t,e,i){const n=Math.floor(i/6e4),s=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:i,canvas:t}}place(t,e,i,n){let s=!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 v=this.shape(f);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=n)s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*v*Math.cos(-f)),e.y=o+~~(h*v*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(F3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}j3(p,this._size)&&(p=z3(p,this._size))}else if(j3(p,this._size)){s&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(s=!0,(!i||L3(p,i))&&(!i||!D3(p,t,this._size))){const i=p.sprite,n=p.width>>5,s=this._size[0]>>5,r=p.x-(n<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*s+(r>>5);for(let e=0;e>>a:0);c+=s}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}`,n=t.x1-t.x0,s=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:n,height:s});const{width:r,height:a}=this.cacheMap.get(i);(n=n&&a>=s}}function D3(t,e,i){const n=i[0]>>5,s=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)*n+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=n}return!1}function L3(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,j3=(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 z3(t,e){const i=t.sprite,n=t.y1-t.y0,s=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(n+(e[1]-(t.y1+t.y)),n),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(s+(e[0]-(t.x1+t.x)>>5)+1,s);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,n,s)=>{const r=s.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],n=e+r[a][1];i>=this.ngx||n>=this.ngy||i<0||n<0||this.fillGridAt(i,n)}},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 n=[];for(0===t&&n.push([this.center[0],this.center[1],0]);i--;){const s=this.shape(i/e*2*Math.PI);n.push([this.center[0]+t*s*Math.cos(-i/e*2*Math.PI),this.center[1]+t*s*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=n,n}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var i;const n=this.options.clip?1:e,s=Math.max(Math.floor(this.getTextFontSize(t)*n),this.options.minFontSize);let r=this.getText(t)+"";if(this.options.clip&&(r=r.slice(0,Math.ceil(r.length*e))),!r)return null;const a=this.getTextFontWeight(t),o=this.getTextFontStyle(t),l=this.getTextRotate&&null!==(i=this.getTextRotate(t))&&void 0!==i?i:0,h=this.getTextFontFamily(t),c=document.createElement("canvas"),d=c.getContext("2d",{willReadFrequently:!0});d.font=o+" "+a+" "+s.toString(10)+"px "+h;const u=d.measureText(r).width,p=Math.max(s,d.measureText("m").width,d.measureText("W").width);let g=u+2*p,f=3*p;const v=Math.ceil(g/this.gridSize),m=Math.ceil(f/this.gridSize);g=v*this.gridSize,f=m*this.gridSize;const y=-u/2,_=.4*-p,b=Math.ceil((g*Math.abs(Math.sin(l))+f*Math.abs(Math.cos(l)))/this.gridSize),x=Math.ceil((g*Math.abs(Math.cos(l))+f*Math.abs(Math.sin(l)))/this.gridSize),S=x*this.gridSize,w=b*this.gridSize;c.setAttribute("width",""+S),c.setAttribute("height",""+w),d.scale(1,1),d.translate(S/2,w/2),d.rotate(-l),d.font=o+" "+a+" "+s.toString(10)+"px "+h,d.fillStyle="#000",d.textBaseline="middle",d.fillText(r,y,_);const A=d.getImageData(0,0,S,w).data;if(this.exceedTime())return null;const k=[];let M,C=x;const T=[b/2,x/2,b/2,x/2],E=(t,e,i)=>{let n=this.gridSize;for(;n--;){let s=this.gridSize;for(;s--;)if(A[4*((e*this.gridSize+n)*S+(t*this.gridSize+s))+3])return i.push([t,e]),tT[1]&&(T[1]=t),eT[2]&&(T[2]=e))}};for(;C--;)for(M=b;M--;)E(C,M,k);return{datum:t,occupied:k,bounds:T,gw:x,gh:b,fillTextOffsetX:y,fillTextOffsetY:_,fillTextWidth:u,fillTextHeight:p,fontSize:s,fontStyle:o,fontWeight:a,fontFamily:h,angle:l,text:r}}canFitText(t,e,i,n,s){let r=s.length;for(;r--;){const i=t+s[r][0],n=e+s[r][1];if(i>=this.ngx||n>=this.ngy||i<0||n<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][n])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],n=this.getTextInfo(i,e);if(!n)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||n.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=n.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let s=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-n.gw/2),i=Math.floor(t[1]-n.gh/2),r=n.gw,a=n.gh;return!!this.canFitText(e,i,r,a,n.occupied)&&(n.distance=this.maxRadius-s,n.theta=t[2],this.outputText(e,i,n),this.updateGrid(e,i,r,a,n),!0)};for(;s--;){let t=this.getPointsAtRadius(this.maxRadius-s);if(this.options.random&&(t=[].concat(t),Y(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&n.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const n=this.getTextColor(i),s={text:i.text,datum:i.datum,color:n,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(s),this.progressiveResult&&this.progressiveResult.push(s)}initGrid(t){let e;if(this.grid=[],t){let i=document.createElement("canvas").getContext("2d");i.fillStyle=this.options.backgroundColor,i.fillRect(0,0,1,1);let n=i.getImageData(0,0,1,1).data,s=t.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize).data;const r=(t,i)=>{let r=this.gridSize;for(;r--;){let a=this.gridSize;for(;a--;)for(e=4;e--;)if(s[4*((i*this.gridSize+r)*this.ngx*this.gridSize+(t*this.gridSize+a))+e]!==n[e])return void(this.grid[t][i]=!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=i=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}layout(t,e){this.initProgressive(),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:n}=E3(this.options.shape,[e.width,e.height]);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(n/this.gridSize),this.initGrid(e.canvas),this.result=[];let s=0;for(;s0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),s=this.center[0]-a/2+n*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+n*l*Math.sin(i),e.left=s,e.top=r,e.x=s+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)}N3.defaultOptions={enlarge:!1};const W3={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},G3=(t,e)=>{var i,n,s,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return qe.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?U3(t.fontFamily):"sans-serif",d=t.fontStyle?U3(t.fontStyle):"normal",u=t.fontWeight?U3(t.fontWeight):"normal",p=t.rotate?U3(t.rotate):0,g=U3(t.text),f=null!==(n=t.spiral)&&void 0!==n?n:"archimedean",v=t.padding?U3(t.padding):1,m=null!==(s=t.shape)&&void 0!==s?s:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,b=null!==(a=t.enlarge)&&void 0!==a&&a,x=null!==(o=t.clip)&&void 0!==o&&o,S=t.minFontSize,w=t.randomVisible,A=t.as||W3,k=t.depth_3d,M=t.postProjection;let C=t.fontSize?U3(t.fontSize):14;const T=t.fontSizeRange;if(T&&!y(C)){const t=C,e=X3($3(t,l),T);C=i=>e(t(i))}let E=I3;"fast"===t.layoutType?E=N3:"grid"===t.layoutType&&(E=H3);const P=new E({text:g,padding:v,spiral:f,shape:m,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:C,shrink:_,clip:x,enlarge:b,minFontSize:S,random:w,progressiveStep:t.progressiveStep,progressiveTime:t.progressiveTime,outputCallback:t=>{const e=[];let i,n;for(let s=0,r=t.length;s0||t.progressiveTime>0?{progressive:P}:P.output()},U3=t=>g(t)||y(t)||o(t)?t:e=>e[t.field],Y3=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),X3=(t,e)=>{if(t[0]===t[1])return t=>e[0];const i=Y3(t[0]),n=Y3(t[1]),s=Math.min(i,n),r=Math.max(i,n);return t=>(Y3(t)-s)/(r-s)*(e[1]-e[0])+e[0]},$3=(t,e)=>{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]};function K3(t,e,i,n,s){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,n,s){const{x:r,y:a}=s,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l/^[\u4e00-\u9fa5]+$/.test(t),J3=(t,e)=>{if(l(t))return 0;let i=0;for(const e of t)Z3(e)?i+=1:i+=.53;return i};var Q3=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};function t5(t){return Q3(this,void 0,void 0,(function*(){const e=yield(i=t.shapeUrl,i&&(b(i)||S(i)||i.startsWith("{const n=GO({image:i});n.successCallback=()=>{var s;if(n){const r=null===(s=n.resources)||void 0===s?void 0:s.get(i);r&&"success"===r.state&&r.data?t(r.data):e(new Error("image load failed"+i))}else e(new Error("image load failed"+i))},n.failCallback=()=>{qe.getInstance().error("image 加载失败!",i)}})):null);var i;return t.removeWhiteBorder&&e?function(t,e,i){e.width=t.width,e.height=t.height,i.clearRect(0,0,e.width,e.height),i.drawImage(t,0,0);const n=e.width,s=i.getImageData(0,0,e.width,e.height);let r=0,a=s.height,o=0,l=s.width;for(;rr&&n5(s,n,a-1);)--a;for(;oo&&s5(s,n,l-1,r,a);)--l;const h=i.getImageData(o,r,l-o,a-r);return e.width=h.width,e.height=h.height,i.clearRect(0,0,e.width,e.height),i.putImageData(h,0,0),e}(e,t.tempCanvas,t.tempCtx):e}))}function e5(t,e){const{size:i,tempCanvas:n,tempCtx:s}=e,r=function(t,e){const i=t.width,n=t.height;let s=e[0]/i;n*s>e[1]&&(s=e[1]/n);const r=Math.floor(s*i),a=Math.floor(s*n);return{x:(e[0]-r)/2,y:(e[1]-a)/2,width:r,height:a,scale:s}}(t,i);n.width=i[0],n.height=i[1],s.clearRect(0,0,n.width,n.height),s.drawImage(t,r.x,r.y,r.width,r.height);const a=s.getImageData(0,0,i[0],i[1]),o=new Array(i[0]*i[1]).fill(0);let l=1;const h=[[0,1],[1,0],[-1,0],[0,-1]];let c=[];for(let t=0;t=i[1]?i[1]-1:n,s=s<0?0:s>=i[0]?i[0]-1:s,0!==o[n*i[0]+s]||i5(a,n,s)||(o[n*i[0]+s]=l,c.push([n,s]))}l++,c=[]}const d={},u={},p={},g={},f={},v={},m={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0,width:0,height:0};for(let t=0;tg[n][1]&&(g[n][1]=t),eg[n][3]&&(g[n][3]=e),em.x2&&(m.x2=e),tm.y2&&(m.y2=t)),u[n]=u[n]||0,u[n]++)}const y=[];for(const t in d){const e=d[t],i=~~(e.reduce(((t,e)=>t+e[0]),0)/e.length),n=~~(e.reduce(((t,e)=>t+e[1]),0)/e.length);p[t]=[i,n],y.push(...e);const[s,r,a,o]=g[t];f[t]=~~Math.max(Math.sqrt((i-a)**2+(n-s)**2),Math.sqrt((i-o)**2+(n-r)**2),Math.sqrt((i-a)**2+(n-r)**2),Math.sqrt((i-o)**2+(n-s)**2)),v[t]=(o-a)/(r-s)}const _=Object.keys(p).map((t=>({label:t-1,boundary:d[t],area:u[t],center:p[t],maxPoint:g[t],maxR:f[t],ratio:v[t]})));m.width=m.x2-m.x1+1,m.height=m.y2-m.y1+1;const b=~~(y.reduce(((t,e)=>t+e[0]),0)/y.length),x=~~(y.reduce(((t,e)=>t+e[1]),0)/y.length),S=~~Math.max(Math.sqrt((b-m.x1)**2+(x-m.y1)**2),Math.sqrt((b-m.x2)**2+(x-m.y2)**2),Math.sqrt((b-m.x1)**2+(x-m.y2)**2),Math.sqrt((b-m.x2)**2+(x-m.y1)**2)),w=m.width/m.height,A=Object.keys(u).reduce(((t,e)=>t+u[e]),0),k={regions:_,labels:o,labelNumber:l-1};return Object.assign(e,{segmentation:k,shapeConfig:r,shapeBounds:m,shapeMaxR:S,shapeRatio:w,shapeCenter:[b,x],shapeArea:A});function M(t,e){const n=[[0,1],[1,0],[-1,0],[0,-1]];if(0===t||0===e||t===i[1]-1||e===i[0]-1)return!0;for(let s=0;s<4;s++){let r=t+n[s][0],a=e+n[s][1];if(r=r<0?0:r>=i[1]?i[1]-1:r,a=a<0?0:a>=i[0]?i[0]-1:a,0===o[r*i[0]+a])return!0}return!1}}function i5(t,e,i){const n=t.width;return 0===t.data[e*n*4+4*i+3]||255===t.data[e*n*4+4*i+0]&&255===t.data[e*n*4+4*i+1]&&255===t.data[e*n*4+4*i+2]}function n5(t,e,i){for(let n=0;nb&&(x=t.sort(((t,e)=>e.weight-t.weight))[b].weight);for(let e=0;ex&&_>r){const e=i.datum[Symbol.for("vGrammar_id")];e!==m&&(m=e,y=_),_*=v,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*v})),f=g.slice(0),b=!0;break}if(!i.skip&&i.datum[Symbol.for("vGrammar_id")]===m){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/_})),i.skip=!0,_=y,m=null,f=g.slice(0),b=!0;break}}}b&&(e=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t=i)break;if(e.x=~~(o+u),e.y=~~(l+p),!(e.x-c<0||e.x+g>s[0]||e.y-a<0||e.y+h>s[1]||l5(e,t,r)))return o5(e,t,r),!0}return!1}function o5(t,e,i){const{wordSize:n}=t,s=t.sprite,r=n[0]>>5,a=i[0]>>5,o=t.x-(r<<4),l=o%32,h=32-l,c=n[1];let d,u=(t.y-(n[1]>>1))*a+(o>>5);if(0===l)for(let t=0;t>>l:0);u+=a}}function l5(t,e,i){const{sprite:n,wordSize:s}=t,r=i[0]>>5,a=s[0]>>5,o=t.x-(a<<4),l=o%32,h=32-l,c=s[1];let d,u=(t.y-(s[1]>>1))*r+(o>>5);if(0===l)for(let t=0;t>>l:0))&e[u+i])return!0;u+=r}return!1}function h5(t,e,i,n){if(i[n].sprite||0===i[n].fontSize)return;const s=2048,r=Math.PI/180,a=i.length;t.width=s,t.height=2048,e.clearRect(0,0,s,2048),e.textAlign="center";let o,l,h=0,c=0,d=0,u=0;const p=n;for(--n;++n>5<<5,l=Math.ceil(l),l>d&&(d=l),h+o>=s&&(h=0,c+=d,d=l),c+l>=2048){if(0===c){t.hasText=!1;continue}break}c+l>=u&&(u=c+l),e.translate(h+(o>>1),c+(l>>1)),0!==t.rotate&&e.rotate(t.rotate*r),e.fillText(t.text,0,0),t.padding&&(e.lineWidth=2*t.padding,e.strokeText(t.text,0,0)),e.restore(),t.LT=[h,c],t.wordSize=[o,l],t.hasText=!0,h+=o}if(0===u)return;const g=e.getImageData(0,0,s,u).data;let f,v;for(;--n>=p;){const t=i[n];if(!t.hasText){t.bounds={dTop:1/0,dBottom:-1/0,dLeft:1/0,dRight:-1/0};break}const{LT:e=[0,0],wordSize:r}=t;[h,c]=e;const a=r[0]>>5,o=new Array(a*r[1]).fill(0);let[l,d,u,p]=[1/0,-1/0,1/0,-1/0];for(v=0;v0){const e=1<<31-f%32;o[a*v+(f>>5)]|=e,fp&&(p=f),t|=e}t&&(vd&&(d=v))}t.bounds={dTop:(r[1]>>1)-l,dBottom:d-(r[1]>>1),dLeft:(r[0]>>1)-u,dRight:p-(r[0]>>1)},t.sprite=o,delete t.LT}}function c5(t){const{segmentation:{labels:e},boardSize:i,size:n}=t,s=i[0]>>5,r=new Array(s*n[1]).fill(0);for(let t=0;t>5)]|=e}if(i[0]>n[0]){const t=(1<{const i=t.area;i>n&&(n=i,r=e),s+=i}));let a=0;i.forEach((e=>{const i=e.area,r=Math.ceil(i/s*t.length),o=i/n;e.words=[],e.regionNum=r,e.regionWeight=o,a+=r})),at.regionNum));t.forEach((t=>{let e=0,n=0;t.regionIndex=-1;do{if(l[o]>0&&t.weight<=i[o].regionWeight){t.regionIndex=o,i[o].words.push(t),l[o]--,o=(o+1)%i.length;break}o=(o+1)%i.length,e++,n++,n>i.length+1&&(i.forEach((t=>{t.regionWeight+=.15})),n=0)}while(-1===t.regionIndex&&e<3*i.length);-1===t.regionIndex&&(t.regionIndex=r,i[r].words.push(t),l[r]--)})),i.forEach((t=>{t.words.sort(((t,e)=>e.weight-t.weight))}))})(t,i),"ensureMapping"===e.layoutMode?r5(t,e,i):"ensureMappingEnlarge"===e.layoutMode?function(t,e,i){const{size:n,stepFactor:s,importantWordCount:r}=e,{segmentation:{regions:a},tempCtx:o,tempCanvas:l,boardSize:h,shapeCenter:c,shapeMaxR:d,shapeRatio:u}=i,p=c5(i);let g=p.slice(0);const f=e.fontSizeEnlargeFactor,v=Math.min(r,t.length);let m=0;t.length>v&&(m=t.sort(((t,e)=>e.weight-t.weight))[v-1].weight);let y=0,_=1,b=!1;for(let r=0;r=m&&y++,y>=v&&!b){_*=f,t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize*f})),g=p.slice(0),w=!0,y=0;break}}else{if(a.weight>=m&&_>1){t.forEach((t=>{t.hasText=!1,t.sprite=null,t.fontSize=t.fontSize/f})),_/=f,b=!0,g=p.slice(0),w=!0;break}if(a.weight>=m)return r5(t,e,i)}}w&&(r=-1)}for(let i=0;i(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;t(t.hasPlaced||(t.hasText=!1,t.sprite=null,t.fontSize=~~(t.fontSize*e.fontSizeShrinkFactor)),!t.hasPlaced)));if(0===i.length)break;for(let t=0;td?w-d:d,A=A>p?A-p:p;return k;function M(e,i){const s=t.map((t=>{const{text:n,color:s,fillingColor:r,hasPlaced:a,datum:c}=t;return{x:0,y:0,weight:0,text:n,fontFamily:h(c),fontStyle:o(c),fontWeight:l(c),fontSize:e,rotate:g[~~(S()*g.length)],padding:f(c),opacity:i,visible:!0,color:s,fillingColor:r,hasPlaced:a,datum:c}}));C(s);let c=0;const{x1:d,y1:u,x2:p,y2:w}=_,[A,M]=[d+~~(S()*r*2),u+~~(S()*a*2)];for(let t=M;t<=w;t+=a)for(let e=A;e<=p;e+=r){h5(x,b,s,c);const i=s[c];i.x=e,i.y=t;const{wordSize:r,bounds:a,hasPlaced:o}=i;if(!o||!a){++c===s.length&&(c=0,v&&C(s));continue}const{dTop:l,dBottom:h,dLeft:d,dRight:u}=a;i.x-d<0||i.x+u>n[0]||i.y-l<0||i.y+h>n[1]||i.hasText&&i.sprite&&!l5(i,m,y)&&(o5(i,m,y),k.push(Object.assign({},i)),++c===s.length&&(c=0,v&&C(s)))}}function C(t){return t.sort((()=>S()-.5))}}(t,e,i),s=[],r=[];for(let e=0;et.visible=!1)),{fillingWords:n,successedWords:r,failedWords:s}}var u5=function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function a(t){try{l(n.next(t))}catch(t){r(t)}}function o(t){try{l(n.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((n=n.apply(t,e||[])).next())}))};const p5={x:"x",y:"y",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle",opacity:"opacity",visible:"visible",isFillingWord:"isFillingWord",color:"color"},g5=(t,e,i,n)=>u5(void 0,void 0,void 0,(function*(){var i,s,r;if(!t.size||l(t.size[0])||l(t.size[1])||t.size[0]<=0||t.size[1]<=0)return qe.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];t.size=[Math.ceil(t.size[0]),Math.ceil(t.size[1])],t.shape||Oo("WordcloudShape shape must be specified."),t.text||Oo("WordcloudShape text must be specified."),(null==n?void 0:n.emit)&&n.emit(q3.BEFORE_WORDCLOUD_SHAPE_LAYOUT);const a=e,o=t.as||p5;if(!a||0===a.length)return[];const h={shapeUrl:t.shape,size:t.size,ratio:t.ratio||.8,tempCanvas:void 0,tempCtx:void 0,removeWhiteBorder:t.removeWhiteBorder||!1,boardSize:[0,0],random:!1,randomGenerator:void 0},c=XH.createCanvas({width:t.size[0],height:t.size[1]}),d=c.getContext("2d");d.textAlign="center",d.textBaseline="middle",h.tempCanvas=c,h.tempCtx=d;const u=t.size[0]+31>>5<<5;h.boardSize=[u,t.size[1]],h.random?h.randomGenerator=Math.random:h.randomGenerator=(()=>{let t=-1;const e=[0,.1,.2,.3,.4,.5,.6,.7,.8,.9];return()=>(t=(t+1)%e.length,e[t])})();const p=yield t5(h);if(!p)return[];const g=e5(p,h),f=t.colorMode||"ordinal",v={getText:_5(t.text),getFontSize:_5(t.fontSize),fontSizeRange:t.fontSizeRange,colorMode:f,getColor:t.colorField?_5(t.colorField):_5(t.text),getFillingColor:_5(t.fillingColorField),colorList:t.colorList||("ordinal"===f?["#2E62F1"]:["#537EF5","#2E62F1","#2358D8","#184FBF","#0C45A6","#013B8E"]),getColorHex:_5(t.colorHexField),getFontFamily:_5(t.fontFamily||"sans-serif"),rotateList:t.rotateList||[0],getPadding:_5(t.padding||1),getFontStyle:_5(t.fontStyle||"normal"),getFontWeight:_5(t.fontWeight||"normal"),getFontOpacity:t.fontOpacity?_5(t.fontOpacity):()=>1};v5(a,v,g);const m={size:t.size,ratio:t.ratio||.8,shapeUrl:t.shape,random:void 0===t.random||t.random,textLayoutTimes:t.textLayoutTimes||3,removeWhiteBorder:t.removeWhiteBorder||!1,layoutMode:t.layoutMode||"default",fontSizeShrinkFactor:t.fontSizeShrinkFactor||.8,stepFactor:t.stepFactor||1,importantWordCount:t.importantWordCount||10,globalShinkLimit:t.globalShinkLimit||.2,fontSizeEnlargeFactor:t.fontSizeEnlargeFactor||1.5,fillingRatio:t.fillingRatio||.7,fillingTimes:t.fillingTimes||4,fillingXStep:t.fillingXRatioStep?Math.max(Math.floor(t.size[0]*t.fillingXRatioStep),1):t.fillingXStep||4,fillingYStep:t.fillingYRatioStep?Math.max(Math.floor(t.size[1]*t.fillingYRatioStep),1):t.fillingYStep||4,fillingInitialFontSize:t.fillingInitialFontSize,fillingDeltaFontSize:t.fillingDeltaFontSize,fillingInitialOpacity:t.fillingInitialOpacity||.8,fillingDeltaOpacity:t.fillingDeltaOpacity||.05,getFillingFontFamily:_5(t.fillingFontFamily||"sans-serif"),getFillingFontStyle:_5(t.fillingFontStyle||"normal"),getFillingFontWeight:_5(t.fillingFontWeight||"normal"),getFillingPadding:_5(t.fillingPadding||.4),fillingRotateList:t.fillingRotateList||[0,90],fillingDeltaFontSizeFactor:t.fillingDeltaFontSizeFactor||.2,fillingColorList:t.fillingColorList||["#537EF5"],sameColorList:!1},y=((t,e)=>{if(1===e.length&&"#537EF5"===e[0])return!0;if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i{const i=J3(s(e));return i>l?t:t+i}),0)/t.length;let c;if(0===h)c=8;else{const t=.2*n.shapeArea;c=Math.sqrt(e*(t/h))}r=~~c,a=c*i.fillingDeltaFontSizeFactor,Object.assign(i,{fillingInitialFontSize:r,fillingDeltaFontSize:a})}}(a,v,m,g);const{getText:_,getFontFamily:b,getFontStyle:x,getFontWeight:S,getPadding:w,getColor:A,getFillingColor:k,getColorHex:M,fontSizeScale:C,colorScale:T,fillingColorScale:E,getFontOpacity:P,rotateList:R}=v,O=a.map((e=>{var i,n;return{x:0,y:0,weight:0,text:_(e),fontFamily:b(e),fontWeight:S(e),fontStyle:x(e),rotate:R[~~(h.randomGenerator()*R.length)],fontSize:~~C(e),opacity:P(e),padding:w(e),color:M&&M(e)||T&&T(A(e))||"black",fillingColor:!k||(null===(i=t.colorField)||void 0===i?void 0:i.field)===(null===(n=t.fillingColorField)||void 0===n?void 0:n.field)&&y?void 0:M&&M(e)||E&&E(k(e))||"black",datum:e,visible:!0,hasPlaced:!1}})),B=Math.max(...O.map((t=>t.fontSize)));O.forEach((t=>t.weight=t.fontSize/B)),O.sort(((t,e)=>e.weight-t.weight));const{fillingWords:I,successedWords:D,failedWords:L}=d5(O,m,g);let F,j;const z=[];for(let t=0;t{var n,s;const r={};r[o.x]=e.x,r[o.y]=e.y,r[o.fontFamily]=e.fontFamily,r[o.fontSize]=e.fontSize,r[o.fontStyle]=e.fontStyle,r[o.fontWeight]=e.fontWeight,r[o.angle]=Kt(e.rotate),r[o.opacity]=e.opacity,r[o.visible]=e.visible,r[o.isFillingWord]=!0,r[o.color]=k?(null===(n=t.colorField)||void 0===n?void 0:n.field)===(null===(s=t.fillingColorField)||void 0===s?void 0:s.field)&&y?e.color:e.fillingColor:m.fillingColorList[~~(h.randomGenerator()*m.fillingColorList.length)],r[H]=e.text,r[N]=`${e.text}_${i}_fillingWords`,V.push(r)})),(null==n?void 0:n.emit)&&n.emit(q3.AFTER_WORDCLOUD_SHAPE_LAYOUT,{successedWords:D,failedWords:L}),z.concat(V)})),f5=(t,e,i,n)=>{var s,r,a,o;const{colorMode:l,getColor:h,getFillingColor:c}=e,{sameColorList:d}=i;let u,p,g=e.colorList,f=i.fillingColorList;if("ordinal"===l){const e=t.map((t=>h(t)));if(u=t=>(new ul).domain(e).range(g).scale(t),c&&((null===(s=n.colorField)||void 0===s?void 0:s.field)!==(null===(r=n.fillingColorField)||void 0===r?void 0:r.field)||!d)){const e=t.map((t=>c(t)));p=t=>(new ul).domain(e).range(f).scale(t)}}else{1===g.length&&(g=[g[0],g[0]]);const e=(new Zl).domain(y5(h,t)).range(g);if(u=t=>e.scale(t),c&&((null===(a=n.colorField)||void 0===a?void 0:a.field)!==(null===(o=n.fillingColorField)||void 0===o?void 0:o.field)||!d)){1===f.length&&(f=[f[0],f[0]]);const e=(new Zl).domain(y5(c,t)).range(f);p=t=>e.scale(t)}}Object.assign(e,{colorScale:u,fillingColorScale:p})},v5=(t,e,i)=>{let{fontSizeRange:n}=e;const{getFontSize:s,getText:r}=e;let a;if(s){if(s&&n){const e=(new sh).domain(y5(s,t)).range(n);a=t=>e.scale(s(t))}else if(s&&o(s)&&!n){const e=.5,[o,l]=y5(s,t),h=t.map((t=>({text:r(t),value:s(t),weight:l===o?1:(s(t)-o)/(l-o)}))),c=m5(h,i,!0);n=[~~(e*c),~~c];const d=(new sh).domain(y5(s,t)).range(n);a=t=>d.scale(s(t))}}else{const e=t.map((t=>({text:r(t)}))),n=m5(e,i,!1);a="function"==typeof(l=n)?l:function(){return l}}var l;Object.assign(e,{getFontSize:s,fontSizeRange:n,fontSizeScale:a})},m5=(t,e,i)=>{const n=e.shapeArea,s=e.ratio,r=e.segmentation.regions,a=Math.ceil(Math.sqrt(n)/12),o=t.reduce(((t,e)=>{const n=J3(e.text);return n{let i=1/0,n=-1/0;const s=e.length;let r;for(let a=0;an&&(n=r);return 1===e.length&&i===n&&(i-=1e4),[i,n]},_5=t=>t?"string"==typeof t||"number"==typeof t?()=>t:o(t)?t:e=>e[t.field]:null,b5=`${IN}_WORD_CLOUD_ANGLE`,x5=`${IN}_WORD_CLOUD_FILLING_ANGLE`,S5=`${IN}_WORD_CLOUD_WEIGHT`,w5=`${IN}_WORD_CLOUD_TEXT`;pZ.useMark([EQ]),oV("wordcloud",{transform:G3,markPhase:"beforeJoin"},!0),oV("wordcloudShape",{transform:g5,markPhase:"beforeJoin"},!0);class A5 extends wQ{constructor(){super(...arguments),this._fontSizeRange=[10,10],this._isWordCloudShape=!1}setValueField(t){h(t)&&(this._valueField=t,this.setFontSizeRange(w3))}setFontSizeRange(t){h(t)&&h(this._spec.valueField)&&(this._fontSizeRange=t)}setAttrFromSpec(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._fontFamilyField=this._spec.fontFamilyField,this._fontWeightField=this._spec.fontWeightField,this._fontStyleField=this._spec.fontStyleField,this._colorHexField=this._spec.colorHexField,this._colorMode=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:A3,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:S3,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(n=this._spec.maskShape)&&void 0!==n?n:"circle",this._keepAspect=this._spec.keepAspect,this._random=null===(s=this._spec.random)||void 0===s||s,this._fontPadding=null!==(d=null!==(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.word)||void 0===a?void 0:a.padding)&&void 0!==o?o:null===(c=null===(h=null===(l=this._theme)||void 0===l?void 0:l.wordCloud)||void 0===h?void 0:h.word)||void 0===c?void 0:c.padding)&&void 0!==d?d:1,this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:k3},this._spec.wordCloudConfig),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:S3,layoutMode:"default"},null===(u=this._spec)||void 0===u?void 0:u.wordCloudShapeConfig),this._fillingFontPadding=null!==(_=null!==(f=null===(g=null===(p=this._spec)||void 0===p?void 0:p.fillingWord)||void 0===g?void 0:g.padding)&&void 0!==f?f:null===(y=null===(m=null===(v=this._theme)||void 0===v?void 0:v.wordCloud)||void 0===m?void 0:m.fillingWord)||void 0===y?void 0:y.padding)&&void 0!==_?_:1,this._isWordCloudShape=!M3.includes(this._maskShape)}initMark(){this._wordMark=this._createMark(A5.mark.word,{defaultMorphElementKey:this._seriesField,groupKey:this._seriesField,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord))}initMarkStyle(){var t,e,i;const n=this._wordMark,s=this._fillingWordMark,r=(null===(t=this._spec.word)||void 0===t?void 0:t.formatMethod)?w5:this._nameField;n&&this.setMarkStyle(n,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),s&&this.setMarkStyle(s,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[r],x:t=>t.x,y:t=>t.y,fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n),this._trigger.registerMark(s),null===(i=this._tooltipHelper)||void 0===i||i.activeTriggerSet.mark.add(s)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud(),ZJ(jh.word,this._spec)))}getWordOrdinalColorScale(t,e){var i,n,s,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!==(s=null!=o?o:null===(n=this._option.globalScale.getScale("color"))||void 0===n?void 0:n.range())&&void 0!==s?s:dh(this._option.getTheme().colorScheme,this.type);return null===(a=(r=(new mh).domain(l)).range)||void 0===a?void 0:a.call(r,h)}getWordColorAttribute(t,e){var i,n;if("ordinal"===this._colorMode)return{scale:this.getWordOrdinalColorScale(t,e),field:null!==(i=this._seriesField)&&void 0!==i?i:vK};let s=null!==(n=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==n?n:this._option.globalScale.getScale("color").range();return 1===s.length&&(s=[s[0],s[0]]),t=>s[0]}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const{width:K,height:q}=this._region.getLayoutRect();if(!_(K)||!_(q)||!(q>0&&K>0))return;const Z=[],J=this._valueField,Q=new Zl,tt=this._fontWeightRange,et=this._rotateAngles,it=this._fontWeightField,nt=this._wordCloudShapeConfig.fillingRotateAngles;if(J){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[J])));Q.domain([e,i],!0).range(tt),Z.push({type:"map",as:S5,callback:t=>e===i?Q.scale(i):Q.scale(t[J])})}Z.push({type:"map",as:b5,callback:()=>et[Math.floor(Math.random()*et.length)]}),Z.push({type:"map",as:x5,callback:()=>nt[Math.floor(Math.random()*nt.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&Z.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const st=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?Z.push({type:"wordcloudShape",dataIndexKey:fK,size:[K,q],shape:this._maskShape,text:{field:(null===(h=this._spec.word)||void 0===h?void 0:h.formatMethod)?w5:this._nameField},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:et,fontFamily:null!==(c=this._fontFamilyField)&&void 0!==c?c:null===(u=null===(d=this._spec.word)||void 0===d?void 0:d.style)||void 0===u?void 0:u.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(p=this._fontStyleField)&&void 0!==p?p:null===(f=null===(g=this._spec.word)||void 0===g?void 0:g.style)||void 0===f?void 0:f.fontStyle,fillingFontFamily:null!==(m=null===(v=this._wordCloudShapeConfig)||void 0===v?void 0:v.fillingFontFamilyField)&&void 0!==m?m:null===(b=null===(y=this._spec.word)||void 0===y?void 0:y.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:nt,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(Z.push({type:"wordcloud",layoutType:wo(this._option.mode)?this._wordCloudConfig.layoutMode:"fast",size:[K,q],shape:this._maskShape,dataIndexKey:fK,text:{field:st},fontSize:J?{field:J}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(n=this._fontFamilyField)&&void 0!==n?n:null===(r=null===(s=this._spec.word)||void 0===s?void 0:s.style)||void 0===r?void 0:r.fontFamily,fontWeight:it?{field:it}:J?{field:S5}:null,fontStyle:null!==(a=this._fontStyleField)&&void 0!==a?a:null===(l=null===(o=this._spec.word)||void 0===o?void 0:o.style)||void 0===l?void 0:l.fontStyle,randomVisible:this._random,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}),this._wordMark.getProduct().transform(Z)),this._data.getProduct().transform(Z)}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}setValueFieldToStackOffsetSilhouette(){}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}setValueFieldToStack(){}setValueFieldToPercent(){}onLayoutEnd(t){super.onLayoutEnd(t),this.compile()}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return z(e,t)||(i.reMake=!0,i.reCompile=!0),i}}A5.mark=ic;class k5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud}}k5.type=Fh.wordCloud,pZ.useSeries([k5]);class M5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud,this.seriesType=Fh.wordCloud}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}M5.type=jQ.wordCloud,M5.view="singleDefault";class C5 extends A5{constructor(){super(...arguments),this.type=Fh.wordCloud3d}compile(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T,E,P,R,O,B,I,D,L,F,j,z,H,N,V,W,G,U,Y,X,$;super.compile();const K=[],q=this._valueField,Z=new Zl,J=this._fontWeightRange,Q=this._rotateAngles,tt=this._fontWeightField,et=this._wordCloudShapeConfig.fillingRotateAngles;if(q){const[e,i]=Ho(null===(t=this.getViewData())||void 0===t?void 0:t.latestData.map((t=>+t[q])));Z.domain([e,i],!0).range(J),K.push({type:"map",as:S5,callback:t=>e===i?Z.scale(i):Z.scale(t[q])})}K.push({type:"map",as:b5,callback:()=>Q[Math.floor(Math.random()*Q.length)]}),K.push({type:"map",as:x5,callback:()=>et[Math.floor(Math.random()*et.length)]}),(null===(e=this._spec.word)||void 0===e?void 0:e.formatMethod)&&K.push({type:"map",as:w5,callback:this._spec.word.formatMethod});const it=(null===(i=this._spec.word)||void 0===i?void 0:i.formatMethod)?w5:this._nameField;this._isWordCloudShape?K.push({type:"wordcloudShape",size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(c=this._spec.postProjection)&&void 0!==c?c:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotateList:Q,fontFamily:null!==(d=this._fontFamilyField)&&void 0!==d?d:null===(p=null===(u=this._spec.word)||void 0===u?void 0:u.style)||void 0===p?void 0:p.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(g=this._fontStyleField)&&void 0!==g?g:null===(v=null===(f=this._spec.word)||void 0===f?void 0:f.style)||void 0===v?void 0:v.fontStyle,depth_3d:this._spec.depth_3d,fillingFontFamily:null!==(y=null===(m=this._wordCloudShapeConfig)||void 0===m?void 0:m.fillingFontFamilyField)&&void 0!==y?y:null===(b=null===(_=this._spec.word)||void 0===_?void 0:_.style)||void 0===b?void 0:b.fontFamily,fillingPadding:this._fillingFontPadding,fillingFontStyle:null!==(S=null===(x=this._wordCloudShapeConfig)||void 0===x?void 0:x.fillingFontStyleField)&&void 0!==S?S:null===(A=null===(w=this._spec.word)||void 0===w?void 0:w.style)||void 0===A?void 0:A.fontStyle,fillingFontWeight:null!==(M=null===(k=this._wordCloudShapeConfig)||void 0===k?void 0:k.fillingFontWeightField)&&void 0!==M?M:null===(T=null===(C=this._spec.word)||void 0===C?void 0:C.style)||void 0===T?void 0:T.fontWeight,fillingRotateList:et,fillingTimes:null===(E=this._wordCloudShapeConfig)||void 0===E?void 0:E.fillingTimes,fillingXStep:null===(P=this._wordCloudShapeConfig)||void 0===P?void 0:P.fillingXStep,fillingYStep:null===(R=this._wordCloudShapeConfig)||void 0===R?void 0:R.fillingYStep,fillingXRatioStep:null===(O=this._wordCloudShapeConfig)||void 0===O?void 0:O.fillingXRatioStep,fillingYRatioStep:null===(B=this._wordCloudShapeConfig)||void 0===B?void 0:B.fillingYRatioStep,fillingInitialOpacity:null===(I=this._wordCloudShapeConfig)||void 0===I?void 0:I.fillingInitialOpacity,fillingDeltaOpacity:null===(D=this._wordCloudShapeConfig)||void 0===D?void 0:D.fillingDeltaOpacity,fillingInitialFontSize:null===(L=this._wordCloudShapeConfig)||void 0===L?void 0:L.fillingInitialFontSize,fillingDeltaFontSize:null===(F=this._wordCloudShapeConfig)||void 0===F?void 0:F.fillingDeltaFontSize,ratio:null===(j=this._wordCloudShapeConfig)||void 0===j?void 0:j.ratio,fillingRatio:null===(z=this._wordCloudShapeConfig)||void 0===z?void 0:z.fillingRatio,removeWhiteBorder:null===(H=this._wordCloudShapeConfig)||void 0===H?void 0:H.removeWhiteBorder,textLayoutTimes:null===(N=this._wordCloudShapeConfig)||void 0===N?void 0:N.textLayoutTimes,fontSizeShrinkFactor:null===(V=this._wordCloudShapeConfig)||void 0===V?void 0:V.fontSizeShrinkFactor,stepFactor:null===(W=this._wordCloudShapeConfig)||void 0===W?void 0:W.stepFactor,layoutMode:null===(G=this._wordCloudShapeConfig)||void 0===G?void 0:G.layoutMode,importantWordCount:null===(U=this._wordCloudShapeConfig)||void 0===U?void 0:U.importantWordCount,globalShinkLimit:null===(Y=this._wordCloudShapeConfig)||void 0===Y?void 0:Y.globalShinkLimit,fontSizeEnlargeFactor:null===(X=this._wordCloudShapeConfig)||void 0===X?void 0:X.fontSizeEnlargeFactor,fillingDeltaFontSizeFactor:null===($=this._wordCloudShapeConfig)||void 0===$?void 0:$.fillingDeltaFontSizeFactor}):(K.push({type:"wordcloud",layoutType:this._wordCloudConfig.layoutMode,size:[this._region.getLayoutRect().width,this._region.getLayoutRect().height],shape:this._maskShape,postProjection:null!==(n=this._spec.postProjection)&&void 0!==n?n:"StereographicProjection",dataIndexKey:fK,text:{field:it},fontSize:q?{field:q}:this._fontSizeRange[0],fontSizeRange:this._fontSizeRange,padding:this._fontPadding,rotate:{field:b5},fontFamily:null!==(s=this._fontFamilyField)&&void 0!==s?s:null===(a=null===(r=this._spec.word)||void 0===r?void 0:r.style)||void 0===a?void 0:a.fontFamily,fontWeight:tt?{field:tt}:q?{field:S5}:null,fontStyle:null!==(o=this._fontStyleField)&&void 0!==o?o:null===(h=null===(l=this._spec.word)||void 0===l?void 0:l.style)||void 0===h?void 0:h.fontStyle,depth_3d:this._spec.depth_3d,randomVisible:this._random,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}),this._wordMark.getProduct().transform(K)),this._data.getProduct().transform(K)}initMark(){this._wordMark=this._createMark(A5.mark.word,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}),this._isWordCloudShape&&(this._fillingWordMark=this._createMark(A5.mark.fillingWord,{groupKey:this._seriesField,support3d:!0,isSeriesMark:!0}))}initMarkStyle(){var t,e;const i=this._wordMark,n=this._fillingWordMark;i&&this.setMarkStyle(i,{fill:this._colorHexField?t=>t[this._colorHexField]:this.getWordColorAttribute(this._seriesField,!1),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>!t.isFillingWord},"normal",yK.Series),n&&this.setMarkStyle(n,{fill:this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.getWordColorAttribute(this._wordCloudShapeConfig.fillingSeriesField,!0),text:t=>t[this._nameField],x:t=>t.x,y:t=>t.y,z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0},fontFamily:t=>t.fontFamily,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,fontWeight:t=>t.fontWeight,angle:t=>t.angle,visible:t=>t.isFillingWord},"normal",yK.Series),this._trigger.registerMark(i),null===(t=this._tooltipHelper)||void 0===t||t.activeTriggerSet.mark.add(i),this._trigger.registerMark(n),null===(e=this._tooltipHelper)||void 0===e||e.activeTriggerSet.mark.add(n)}initAnimation(){this._wordMark&&this._wordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.word,this._spec))),this._fillingWordMark&&this._fillingWordMark.setAnimationConfig(qJ($J.wordCloud3d((()=>{var t,e,i,n,s;const r=this.getCompiler().getVGrammarView(),a=r.width()-(null===(t=this._padding)||void 0===t?void 0:t.left)||0-(null===(e=this._padding)||void 0===e?void 0:e.right)||0,o=r.height()-(null===(i=this._padding)||void 0===i?void 0:i.top)||0-(null===(n=this._padding)||void 0===n?void 0:n.bottom)||0,l=Math.max(a,o)/2;return{center:{x:l,y:l,z:null!==(s=this._spec.depth_3d)&&void 0!==s?s:l},r:l}})),ZJ(jh.fillingWord,this._spec)))}}C5.type=Fh.wordCloud3d,pZ.useSeries([C5]);class T5 extends x3{constructor(){super(...arguments),this.type=jQ.wordCloud3d,this.seriesType=Fh.wordCloud3d}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}T5.type=jQ.wordCloud3d,T5.view="singleDefault";class E5{constructor(t){this.id=Co(),this.plugins=[],this.component=t}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this.plugins.find((e=>e.id===t.id))?yo("不要重复添加相同的plugin"):(this.plugins.push(t),e.push(t))})),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()}dispose(t){const e=this.plugins.find((e=>e.id===t));e&&e.dispose&&e.dispose(this)}disposeAll(){this.plugins.forEach((t=>{t.dispose&&t.dispose(this)}))}}function P5(t,e){const{x1:i,y1:n,x2:s,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;as&&(u=s-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function R5(t,e,i,n){let s=0,r=t.length-1;for(;s<=r;){const a=Math.floor((s+r)/2),o=t[a];if(o[i]<=e&&o[n||i]>=e)return o;o[i]>e?r=a-1:s=a+1}return null}function O5(t){var e,i;const n=Object.assign({},t);return C(t.style)||(n.textStyle=ON(t.style)),C(t.textStyle)||Lh(n.textStyle,ON(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&ON(n.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&ON(n.background.style),n}function B5(t){return"bottom"===t.orient||"top"===t.orient?"horizontal":"vertical"}function I5(t,e,i,n){var s,r,a;switch(t){case bn.cartesianBandAxis:return x1(UK(i),"band",e);case bn.cartesianLinearAxis:return x1(UK(i),"linear",e);case bn.cartesianLogAxis:return x1(UK(i),"log",e);case bn.cartesianSymlogAxis:return x1(UK(i),"symlog",e);case bn.cartesianAxis:case bn.cartesianTimeAxis:return x1(UK(i),void 0,e);case bn.polarBandAxis:return S1(i.orient,"band",e);case bn.polarLinearAxis:return S1(i.orient,"linear",e);case bn.polarAxis:return S1(i.orient,void 0,e);case bn.cartesianCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,xField:a,yField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>VK(t.getOrient())));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>WK(t.getOrient())));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{xField:c,yField:u}})(e,n);case bn.polarCrosshair:return((t,e)=>{var i;const n=e.getAllComponents().filter((t=>t.type.includes("Axis"))),{bandField:s,linearField:r,categoryField:a,valueField:o}=null!==(i=t.component.crosshair)&&void 0!==i?i:{},l=n.find((t=>"angle"===t.getOrient()));let c;c=h(l)?Lh({},hl(l.getScale().type)?s:r,a):a;const d=n.find((t=>"radius"===t.getOrient()));let u;return u=h(d)?Lh({},hl(d.getScale().type)?s:r,o):o,{categoryField:c,valueField:u}})(e,n);case bn.colorLegend:return null===(s=e.component)||void 0===s?void 0:s.colorLegend[B5(i)];case bn.sizeLegend:return null===(r=e.component)||void 0===r?void 0:r.sizeLegend[B5(i)];default:return null===(a=e.component)||void 0===a?void 0:a[t]}}class D5 extends wZ{getRegions(){return this._regions}created(){super.created(),this.pluginService=new E5(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this._regions=[],this._delegateEvent=(t,e,i,n=null,s=null)=>{var r,a;this.event.emit(i,{model:this,node:t,event:e,item:n,datum:s,source:dK.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._regions=e.getRegionsInIndex(),this.layoutBindRegionID=this._regions.map((t=>t.id)),this._option.animation&&(this.animate=new RZ({getCompiler:e.getCompiler}))}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}eventPos(t){return{x:t.event.viewX-this.getLayoutStartPoint().x,y:t.event.viewY-this.getLayoutStartPoint().y}}setCurrentTheme(t,e){return mn(this,void 0,void 0,(function*(){const i=()=>(this.reInit(t),{change:!0,reMake:!1});e?i():yield this._option.globalInstance.updateCustomConfigAndRerender(i)}))}_initTheme(t){const e=this._option.getTheme();t?super._initTheme(t):super._initTheme(I5(this.type,e,this._originalSpec,this._option.getChart())),this._mergeThemeToSpec();const{padding:i,noOuterPadding:n=!0,orient:s}=this._spec;n&&i&&s&&(this._spec.padding=Object.assign(Object.assign({},Ch(i)),{[s]:0}))}getContainer(){return this._container||(this._container=this._option.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.regionId===this._spec.regionId&&e.regionIndex===this._spec.regionIndex&&e.seriesId===this._spec.seriesId&&e.seriesIndex===this._spec.seriesIndex||(i.reMake=!0),i}release(){super.release(),this.clear()}clear(){var t;this._container=null,null===(t=this.pluginService)||void 0===t||t.disposeAll(),this.pluginService=null}compile(){this.compileSignal(),this.compileMarks()}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t}),null===(i=e.getProduct())||void 0===i||i.configure({context:{model:this}})}))}}const L5=(t,e)=>{const{getNewDomain:i,isContinuous:n,field:s}=e,r=s(),a=i();if(l(a)||l(r))return t;if(0===a.length)return[];let o=null;return o=n()?t=>t[r]>=a[0]&&t[r]<=a[1]:t=>a.indexOf(t[r]+"")>=0||a.indexOf(t[r])>=0,t.filter(o)},F5=(t,e)=>{const{stateFields:i,valueFields:n,dataCollection:s}=e.input,{stateField:r,valueField:a}=e.output,o={},h=[];return s.forEach(((t,e)=>{l(i[e])||t.latestData.forEach((t=>{V(i[e]).forEach((i=>{l(t[i])||(l(o[t[i]])&&(o[t[i]]=0),l(n[e])||(o[t[i]]+=isNaN(parseFloat(t[n[e]]))?1:parseFloat(t[n[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),h.push(i)})),h};class j5 extends D5{get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setStartAndEnd(t,e){this._handleChange(t,e,!0)}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this.layoutType="region-relative",this._orient="left",this._stateField="x",this.effect={onZoomChange:()=>{if(this._relatedAxisComponent&&this._filterMode===OZ.axis){const t=this._relatedAxisComponent.getScale();t.rangeFactor(t.range()[0]{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e)=>{var i,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(i=this.effect).onZoomChange)||void 0===n||n.call(i),!0},this._handleChartScroll=(t,e)=>{this._handleChartDrag([t.scrollX,t.scrollY],e)},this._handleChartZoom=(t,e)=>{const{zoomDelta:i}=t,n=Math.abs(this._start-this._end);if(n>=1&&i>1)return;if(n<=.01&&i<1)return;const s=n*(i-1)/2,r=ut(this._start-s,0,1),a=ut(this._end+s,0,1);this._handleChange(Math.min(r,a),Math.max(r,a),!0)},this._handleChartDrag=(t,e)=>{const[i,n]=t,s=this._isHorizontal?i:n,r=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(s)>=1e-6)if(s>0&&this._end<1){const t=.02*Math.min(1-this._end,s/r);this._handleChange(this._start+t,this._end+t,!0)}else if(s<0&&this._start>0){const t=.02*Math.max(-this._start,s/r);this._handleChange(this._start+t,this._end+t,!0)}},this._orient=UK(t),this._layoutOrient=this._orient,this._isHorizontal=("top"===(i=this._layoutOrient)||"bottom"===i?HK.horizontal:HK.vertical)===HK.horizontal,h(t.autoIndent)&&(this._autoIndent=t.autoIndent)}created(){super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initData(),this._initStateScale(),this._setStateFromSpec()}_setAxisFromSpec(){if(h(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):h(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),l(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=>!ol(t.getScale().type)));this._relatedAxisComponent=e}}}_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(h(i)&&(h(i.userId)&&(this._seriesUserId=V(i.userId)),h(i.specIndex)&&(this._seriesIndex=V(i.specIndex))),h(this._spec.seriesId)){const t=V(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(h(this._spec.seriesIndex)){const t=V(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(h(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(V(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(h(this._spec.regionId)){const t=V(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){const t=this._computeDomainOfStateScale(ol(this._stateScale.type));this._stateScale.domain(t,!0),this._handleChange(this._start,this._end,!0)}_computeDomainOfStateScale(t){const e=this._data.getLatestData().map((t=>t[this._stateField]));return t?e.length?[Math.min.apply(null,e),Math.max.apply(null,e)]:[-1/0,1/0]:e}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const n={};nl(this._regions,(s=>{var r,a;const o="cartesian"===s.coordinate?s.getXAxisHelper():"polar"===s.coordinate?s.angleAxisHelper:null,l="cartesian"===s.coordinate?s.getYAxisHelper():"polar"===s.coordinate?s.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ol(c.getScale(0).type);t.push(s.getRawData());const u=s.getSpec(),p=V(u.xField),g=V(u.yField),f="cartesian"===s.coordinate?p[0]:null!==(r=u.angleField)&&void 0!==r?r:u.categoryField,v="cartesian"===s.coordinate?g[0]:null!==(a=u.radiusField)&&void 0!==a?a:u.valueField;if(n[s.id]="link"===s.type?"from_xField":h===o?f:v,e.push(n[s.id]),this._valueField){const t="link"===s.type?"from_yField":c===o?f:v;i.push(d?t:null)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=n}else l(this._spec.valueField),nl(this._regions,(n=>{t.push(n.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:n}=this._option;cq(n,"dataview",lo),hq(n,"dataFilterComputeDomain",F5);const s=new go(n);s.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new jZ(this._option,s),s.reRunAllTransform(),n.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),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;let i=e.range();!this._isHorizontal&&ol(e.type)&&(i=i.slice().reverse());const n=i[0]+(i[1]-i[0])*t;return e.invert(n)}_dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let n=e.range();return!this._isHorizontal&&ol(e.type)&&(n=n.slice().reverse()),(i-n[0])/(n[1]-n[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&this._spec.start||"value"===e&&this._spec.startValue:"end"===t?"percent"===e&&this._spec.end||"value"===e&&this._spec.endValue:void 0}_setStateFromSpec(){let t,e;if(this._spec.rangeMode){const[i,n]=this._spec.rangeMode;this._modeCheck("start",i)&&this._modeCheck("end",n)&&(t="percent"===i?this._spec.start:this._dataToStatePoint(this._spec.startValue),e="percent"===n?this._spec.end:this._dataToStatePoint(this._spec.endValue))}else t=this._spec.start?this._spec.start:this._spec.startValue?this._dataToStatePoint(this._spec.startValue):0,e=this._spec.end?this._spec.end:this._spec.endValue?this._dataToStatePoint(this._spec.endValue):1;this._startValue=this._statePointToData(t),this._endValue=this._statePointToData(e),this._start=t,this._end=e,this._relatedAxisComponent&&this._filterMode===OZ.axis||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=ol(e.type),n=this._computeDomainOfStateScale(i);this._stateScale=e.clone(),i?this._stateScale.domain(n.length?[Math.min.apply(null,n),Math.max.apply(null,n)]:[0,1],!0).range(t):this._stateScale.domain(n,!0).range(t)}else this._stateScale=new Pl,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&&this._filterMode===OZ.axis||(hq(this._option.dataSet,"dataFilterWithNewDomain",L5),nl(this._regions,(t=>{t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ol(this._stateScale.type)}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ol(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),n=i.indexOf(t),s=i.indexOf(e);return i.slice(Math.min(n,s),Math.max(n,s)+1)}_initCommonEvent(){this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._initCommonEvent(),this._initEvent(),super.updateLayoutAttribute()}boundsInRect(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}}N(j5,d3);class z5 extends j5{static createComponent(t,e){const i=t.scrollBar||e.defaultSpec;if(l(i))return;if(!f(i))return new z5(i,Object.assign(Object.assign({},e),{specKey:"scrollBar"}));const n=[];return i.forEach(((t,i)=>{n.push(new z5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"scrollBar"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.scrollBar,this.name=bn.scrollBar,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.axis}onLayoutEnd(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return y(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_createOrUpdateComponent(){if(!this._component){const t=this.getContainer();this._component=new qG(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"},this._getComponentAttrs())),t.add(this._component)}}_handleChange(t,e,i){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.scrollBarChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}_handleDataCollectionChange(){}_initEvent(){this._component&&this._component.on("scroll",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_initCommonEvent(){this._spec.roam&&(this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll),this.initDragEventOfRegions(this._regions,null,this._handleChartDrag))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,n={};return l(i)||(n.padding=i),C(null==t?void 0:t.style)||(n.railStyle=ON(t.style)),C(null==e?void 0:e.style)||(n.sliderStyle=ON(e.style)),n}}z5.type=bn.scrollBar;class H5 extends j5{static createComponent(t,e){const i=t.dataZoom||e.defaultSpec;if(l(i))return;if(!f(i))return new H5(i,Object.assign(Object.assign({},e),{specKey:"dataZoom"}));const n=[];return i.forEach(((t,i)=>{n.push(new H5(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"dataZoom"})))})),n}constructor(t,e){var i;super(t,Object.assign({},e)),this.type=bn.dataZoom,this.name=bn.dataZoom,this.layoutZIndex=PK.DataZoom,this.layoutLevel=RK.DataZoom,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=this._isHorizontal?this._stateField:this._valueField;return n.scale(t[s])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,n=this._isHorizontal?this._stateScale:this._valueScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=this._isHorizontal?this._valueField:this._stateField;return n.scale(t[s])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,n=this._isHorizontal?this._valueScale:this._stateScale,s=n.domain()[0];return n.scale(s)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:OZ.filter}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,n,s,r,a,o,h,c;super.setAttrFromSpec(),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(),l(null===(s=null===(n=null===(i=this._originalSpec)||void 0===i?void 0:i.startHandler)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),l(null===(o=null===(a=null===(r=this._originalSpec)||void 0===r?void 0:r.startHandler)||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===(h=this._spec.startHandler.style.visible)||void 0===h||h,u=null===(c=this._spec.endHandler.style.visible)||void 0===c||c;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=u?this._spec.endHandler.style.size:0}_prepareSpecBeforeMergingTheme(t){const e=Object.assign({},t),{selectedBackgroundChart:i={}}=e,{line:n,area:s}=i;return(n||s)&&(e.selectedBackgroundChart=Object.assign(Object.assign({},i),{line:n&&!1!==n.visible?Object.assign(Object.assign({},n),{style:Object.assign(Object.assign({},n.style),{visible:!0})}):n,area:s&&!1!==s.visible?Object.assign(Object.assign({},s),{style:Object.assign(Object.assign({},s.style),{visible:!0})}):s})),e}onLayoutEnd(t){this._updateScaleRange(),super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new Zl;e.domain(t),this._valueScale=e}}_updateScaleRange(){const t=(this._startHandlerSize+this._endHandlerSize)/2;this._stateScale&&this._valueScale&&(this._isHorizontal?(this._stateScale.range([0,this._computeWidth()-t]),this._valueScale.range([this._computeHeight()-this._middleHandlerSize,0])):"left"===this.layoutOrient?(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([this._computeWidth()-this._middleHandlerSize,0])):(this._stateScale.range([0,this._computeHeight()-t]),this._valueScale.range([0,this._computeWidth()-this._middleHandlerSize])),this._component&&this._component.setAttributes({size:{width:this._computeWidth(),height:this._computeHeight()}}))}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField]));return t.length?[Math.min.apply(null,t),Math.max.apply(null,t)]:null}_computeMiddleHandlerSize(){var t,e,i,n;let s=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!==(n=this._spec.middleHandler.background.size)&&void 0!==n?n:40;s+=Math.max(t,e)}return s}_computeWidth(){return!1===this._visible?0:y(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:y(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height-(this._startHandlerSize+this._endHandlerSize)/2}_createOrUpdateComponent(){var t,e,i;if(!this._component&&this._visible){const n=this.getContainer();this._component=new IY(Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this.getLayoutRect().width,height:this.getLayoutRect().height},showDetail:null===(t=this._spec)||void 0===t?void 0:t.showDetail,brushSelect:null!==(i=null===(e=this._spec)||void 0===e?void 0:e.brushSelect)&&void 0!==i&&i,previewData:this._data.getLatestData(),previewCallbackX:this._dataToPositionX,previewCallbackY:this._dataToPositionY},this._getComponentAttrs())),this._isHorizontal?this._component.setPreviewCallbackY1(this._dataToPositionY2):this._component.setPreviewCallbackX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.setUpdateStateCallback(((t,e)=>{this._handleChange(t,e)})),n.add(this._component),this._updateScaleRange()}}_handleChange(t,e,i){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;this._handleStateChange(this._statePointToData(t),this._statePointToData(e))&&this.event.emit(cK.dataZoomChange,{model:this,value:{filterData:this._filterMode!==OZ.axis,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)}}_initEvent(){}_getComponentAttrs(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A;return{backgroundStyle:ON(null===(t=this._spec.background)||void 0===t?void 0:t.style),startHandlerStyle:ON(null===(e=this._spec.startHandler)||void 0===e?void 0:e.style),middleHandlerStyle:{visible:null!==(n=null===(i=this._spec.middleHandler)||void 0===i?void 0:i.visible)&&void 0!==n&&n,icon:ON(null===(r=null===(s=this._spec.middleHandler)||void 0===s?void 0:s.icon)||void 0===r?void 0:r.style),background:{size:null===(o=null===(a=this._spec.middleHandler)||void 0===a?void 0:a.background)||void 0===o?void 0:o.size,style:ON(null===(l=this._spec.middleHandler.background)||void 0===l?void 0:l.style)}},endHandlerStyle:ON(null===(h=this._spec.endHandler)||void 0===h?void 0:h.style),startTextStyle:{padding:null===(c=this._spec.startText)||void 0===c?void 0:c.padding,formatMethod:null===(d=this._spec.startText)||void 0===d?void 0:d.formatMethod,textStyle:ON(null===(u=this._spec.startText)||void 0===u?void 0:u.style)},endTextStyle:{padding:null===(p=this._spec.endText)||void 0===p?void 0:p.padding,formatMethod:null===(g=this._spec.endText)||void 0===g?void 0:g.formatMethod,textStyle:ON(null===(f=this._spec.endText)||void 0===f?void 0:f.style)},selectedBackgroundStyle:ON(this._spec.selectedBackground.style),dragMaskStyle:ON(null===(v=this._spec.dragMask)||void 0===v?void 0:v.style),backgroundChartStyle:{line:Lh(ON(null===(y=null===(m=this._spec.backgroundChart)||void 0===m?void 0:m.line)||void 0===y?void 0:y.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(b=null===(_=this._spec.backgroundChart)||void 0===_?void 0:_.area)||void 0===b?void 0:b.style))},selectedBackgroundChartStyle:{line:Lh(ON(null===(S=null===(x=this._spec.selectedBackgroundChart)||void 0===x?void 0:x.line)||void 0===S?void 0:S.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},ON(null===(A=null===(w=this._spec.selectedBackgroundChart)||void 0===w?void 0:w.area)||void 0===A?void 0:A.style))}}}clear(){var t;this._component&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._component),this._component=null),super.clear()}}H5.type=bn.dataZoom;class N5 extends D5{constructor(){super(...arguments),this.type=bn.customMark,this.layoutType="absolute",this.layoutZIndex=PK.CustomMark,this.layoutLevel=RK.CustomMark}static createComponent(t,e){return t.customMark?[new N5(t.customMark,Object.assign(Object.assign({},e),{specIndex:0,specKey:"customMark"}))]:null}created(){super.created(),this.initMarks(),this.initEvent()}initMarks(){this._spec&&this._spec.forEach(((t,e)=>{this._createExtensionMark(t,null,`${IN}_series_${this.id}_extensionMark`,e)}))}_createExtensionMark(t,e,i,n){var s;const r=this._createMark({type:t.type,name:`${IN}_${n}`});if(r&&(l(e)?this._marks.addMark(r):e&&e.addMark(r),this.initMarkStyleWithSpec(r,t),"group"===t.type&&(i=`${i}_${n}`,null===(s=t.children)||void 0===s||s.forEach(((t,e)=>{this._createExtensionMark(t,r,i,e)}))),h(t.dataId)||_(t.dataIndex))){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{r.getData().updateData()})),r.setDataView(e))}}initEvent(){}updateSpec(t,e){const i=this._originalSpec,n=super.updateSpec(e);return z(i,e)||(n.reMake=!0),n.change=!0,n.reRender=!0,n}changeRegions(t){}onRender(t){}}N5.type=bn.customMark;class V5 extends D5{constructor(){super(...arguments),this.layoutType="absolute",this.type=bn.brush,this.name=bn.brush,this.layoutZIndex=PK.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._isFirstState=!0,this._cacheInteractiveRangeAttrs=[]}static createComponent(t,e){const i=t.brush||e.defaultSpec;if(!l(i)&&!1!==i.visible)return[new V5(i,Object.assign(Object.assign({},e),{specKey:V5.speckey}))]}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const n in t[i])e.push(t[i][n].data[0]);return e}_extendDatumOutOfBrush(t){const e=[];for(const i in t)e.push(t[i].data[0]);return e}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint().x,i=e+t.getLayoutRect().width,n=t.getLayoutStartPoint().y,s=n+t.getLayoutRect().height;return{interactiveRange:{minY:n,maxY:s,minX:e,maxX:i},xRange:[e,i],yRange:[n,s]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),n=this._brushComponents[e];n.setAttributes(i),this._initMarkBrushState(e,""),n.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,n;const s=this._getBrushInteractiveAttr(t),r=new BX(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:ON(null===(i=this._spec)||void 0===i?void 0:i.style)},s),this._spec));r.id=null!==(n=this._spec.id)&&void 0!==n?n:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(s),r.setUpdateDragMaskCallback((i=>{const{operateType:n,operateMask:s}=i;(this._isFirstState||this._needInitOutState&&"single"===a&&n===TX.drawing)&&this._initMarkBrushState(e,"outOfBrush"),n===TX.drawing&&(this._needInitOutState=!1),n===TX.drawEnd&&(this._needInitOutState=!0),n===TX.brushClear&&(this._initMarkBrushState(e,""),this._needInitOutState=!0),this._reconfigItem(s,t),this._reconfigLinkedItem(s,t);let r=cK.brushChange;r=n===TX.drawStart||n===TX.moveStart?cK.brushStart:n===TX.drawEnd||n===TX.moveEnd?cK.brushEnd:cK.brushChange,this.event.emit(r,{model:this,value:{operateType:n,operateRegion:t,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap}})}))}_transformBrushedMarkAttr(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({},ON(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var n,s,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(n=this._outOfBrushElementsMap)||void 0===n?void 0:n[o])&&this._isBrushContainItem(t,a)?(a.addState("inBrush"),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(s=this._inBrushElementsMap)||void 0===s?void 0:s[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(a.removeState("inBrush"),a.addState("outOfBrush"),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o])}))}))}_reconfigLinkedItem(t,e){const i=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((n=>{if(!i.includes(n.id)){const i=n.getRegion().getLayoutStartPoint().x-e.getLayoutStartPoint().x,s=n.getRegion().getLayoutStartPoint().y-e.getLayoutStartPoint().y;this._linkedItemMap[n.id].forEach((e=>{const n=e.getProduct();if(!n||!n.elements||!n.elements.length)return;n.elements.forEach((n=>{var r,a,o;const l=n.getGraphicItem(),h=e.id+"_"+n.key;(null===(r=this._linkedOutOfBrushElementsMap)||void 0===r?void 0:r[h])&&this._isBrushContainItem(t,l,{dx:i,dy:s})?(l.addState("inBrush"),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=n,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:i,dy:s})&&(l.removeState("inBrush"),l.addState("outOfBrush"),this._linkedOutOfBrushElementsMap[h]=n)}))}))}}))}_isBrushContainItem(t,e,i){var n,s,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points))return!1;const a=null!==(r=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,f=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g}))),v=t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g),m=e.globalTransMatrix.e,y=e.globalTransMatrix.f;if("symbol"===e.type)return v.contains(m,y)&&Ve(f,m,y);if("rect"===e.type){const{width:t=0,height:i=0}=null==e?void 0:e.attribute;return function(t,e){for(let i=0;i0&&Ne(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(f,[{x:m,y:y},{x:m+t,y:y},{x:m+t,y:y+i},{x:m,y:y+i}])}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_bindRegions(){h(this._spec.regionId)&&h(this._spec.regionIndex)&&(this._relativeRegions=this._option.getAllRegions()),this._relativeRegions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}_bindLinkedSeries(){h(this._spec.brushLinkSeriesId)&&h(this._spec.brushLinkSeriesIndex)||(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(V(this._spec.brushLinkSeriesId),V(this._spec.brushLinkSeriesIndex)))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const n=[];i.getSeries().forEach((s=>{(t&&V(t).includes(s.userId.toString())||e&&V(e).includes(s.getSpecIndex())||!e&&!t)&&n.push(...s.getMarksWithoutRoot()),this._itemMap[i.id]=n}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){var i,n;this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={};const s=this._transformBrushedMarkAttr(null===(i=this._spec)||void 0===i?void 0:i.inBrush),r=this._transformBrushedMarkAttr(null===(n=this._spec)||void 0===n?void 0:n.outOfBrush);this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const n=i.getGraphicItem(),a=t.id+"_"+i.key;n.stateProxy=t=>"inBrush"===t?s:"outOfBrush"===t?r:void 0,n.addState(e),this._outOfBrushElementsMap[a]=i,this._linkedOutOfBrushElementsMap[a]=i}))}))})),this._isFirstState=!1}initEvent(){}onRender(t){}changeRegions(t){}updateSpec(t){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const e=this._spec,i=super.updateSpec(t);return z(e,this._spec)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;super.onLayoutEnd(t);(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clear(){var t;this._brushComponents&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._brushComponents),this._brushComponents.forEach((t=>{t.releaseBrushEvents()})),this._brushComponents=null),super.clear()}}function W5(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function G5(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function U5(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:G5(t.rect),anchorCandidates:Z5(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),n=[];n.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const s=i[t],r=s.bound;let a=n.some((t=>W5(t,r)));if(s.anchorCandidates)if(a&&(null===(e=s.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;tW5(t,i)))){n.push(i),a=!1;break}}a&&n.push(s.bound)}else n.push(s.bound)}return n.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function Y5(t,e,i){const n=t.map((t=>t.pointCoord)),{x1:s,x2:r,y1:a,y2:o}=ze(n),l=i([(s+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const n=t.rect,s=K5(e,t.pointCoord)?i(function(t,e,i,n=200){const s=5621/n;let r=e;for(let e=1;e<=s;e++){const e=fn(r,n,i);if(!K5(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],X5($5(t.point,l)))):t.point;s&&(n.x=s.x,n.y=s.y);const r=X5($5(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=q5(t.rect,a,0),t}));return U5(h)}function X5(t){return t>180?t-360:t}function $5(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function K5(t,e){for(let i=0;i{const{x:r,y:a}=q5(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,n);s.push({x:r,y:a})})),s}V5.type=bn.brush,V5.speckey="inBrush";class J5 extends D5{constructor(){super(...arguments),this.type=bn.mapLabel,this.name=bn.mapLabel,this.layoutType="absolute",this.layoutZIndex=PK.MarkPoint,this._activeDatum=[]}static createComponent(t,e){const i=t.mapLabel;return i&&i.visible&&!h(i.series)?new J5(i,e):null}setAttrFromSpec(){var t,e,i,n;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(n=this._series)||void 0===n?void 0:n.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,n,s,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(s=null===(n=(i=this._regions[0]).getSpec)||void 0===n?void 0:n.call(i))||void 0===s?void 0:s.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new go(this._option.dataSet);t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView"},!1),t.name=`${this.name}_data`,this._data=new jZ(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){this.event.on("zoom",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handleZoom(t),!0))),this.event.on("panmove",{filter:t=>this._isRelativeModel(t.model)},(t=>(this.handlePan(t),!0)));const t=this._spec.trigger;"none"!==t&&("hover"===t?(this.event.on("hovered",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unhovered",(()=>{this._updateDatum([])}))):"click"===t&&(this.event.on("selected",{filter:t=>this._isRelativeSeries(t.model)},(t=>{this._updateDatum(t.value)})),this.event.on("unselected",(()=>{this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const n=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(n)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const n=new YY({position:void 0});return n&&(n.name=`${this.name}_marker_${e}`,n.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,n.setAttribute("zIndex",this.layoutZIndex)),n})));this._markerComponents.forEach(((t,n)=>{t.removeAllChild();const{pairInfo:s,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[n],n);s&&e.push(s),r&&i.push(r)}));const n=this._layoutLabels(e);this._layoutMarkers(n,i),this._renderMarkers()}_evaluateMarker(t,e){var i,n,s,r,a,o,l,c,d,u,p,g;let f=0,v=0,m=0,y=0,_=0;const b=this._spec.position||"top",x=this._spec.offset,S=Ch(null===(i=this._spec.background)||void 0===i?void 0:i.padding),w=this._spec.space||0;v+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),m+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},k=this.dataToPosition(t),M=FO({});if(M.name=`${this.name}_marker_itemContainer_${e}`,A.container=M,null===(n=this._spec.background)||void 0===n?void 0:n.visible){const t=HO(ON(Object.assign({},this._spec.background.style)));t.setAttributes(k),A.labelBackground=t,M.appendChild(t)}if(null===(s=this._spec.icon)||void 0===s?void 0:s.visible){const t=WO(ON(Object.assign({},this._spec.icon.style)));t.setAttributes(k),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,n=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,M.appendChild(t),_=i,y+=n,f++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=VO(ON(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,n=null!==(c=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==c?c:0,s=null!==(d=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==d?d:0;A.nameLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}if((null===(u=this._spec.valueLabel)||void 0===u?void 0:u.visible)&&h(t[this.valueField])){const e=VO(ON(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(k),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,n=null!==(p=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==p?p:0,s=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,M.appendChild(e),_=Math.max(_,n),y+=s,f++}const C=Object.values(A).find((t=>!!t&&"group"!==t.type)),T={x:null==C?void 0:C.getComputedAttribute("x"),y:null==C?void 0:C.getComputedAttribute("y")},E={x:T.x,y:T.y,width:0,height:0};E.width=v+y+(f-1)*w,E.height=m+_;const P={rect:E,point:T,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=q5(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,n,s;for(let r=0;r{var i,n;if(t){const s=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=s.x2-s.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:f+r,y:g}),f+=null!==(n=s.x2-s.x1)&&void 0!==n?n:0,2!==e&&(f+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const v=this._data.getLatestData()[r],m=this.dataToPosition(v),y=!(!(null===(n=this._spec.leader)||void 0===n?void 0:n.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:this.getRegions()[0].getLayoutStartPoint().x,y:this.getRegions()[0].getLayoutStartPoint().y,position:m,visible:this._activeDatum.includes(v),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-m.x,offsetY:d.y+d.height/2-m.y},itemLine:{visible:y,type:"type-po",lineStyle:ON(Object.assign({},null===(s=this._spec.leader)||void 0===s?void 0:s.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):U5(t)}_isRelativeModel(t){var e,i,n;const s=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(n=this._series.getCoordinateHelper())||void 0===n?void 0:n.getCoordinateId();return(null==t?void 0:t.id)===s}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}}function Q5(t){return 2===t.length&&_(t[0])&&_(t[1])&&t[1]>=t[0]}function t4(t,e){const i=e[1]-e[0],n=e[1]*e[0]<0;let s=e[0]<=0?0-e[0]:0,r=e[1]>0?e[1]-0:0;0===i?e[0]<0?(s=1,r=0):e[0]>0&&(s=0,r=1):(s/=i,r/=i);const a=t.getDomainSpec();return{total:i,negative:s,positive:r,includeZero:n,domain:e,extendable_min:!_(a.min),extendable_max:!_(a.max)}}function e4(t,e){const{positive:i,negative:n,extendable_min:s,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=n/i;r&&(t=n/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/n;s&&(t=i/Math.max(n,n),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function i4(t,e){const{extendable_min:i,extendable_max:n,domain:s}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!n)&&(!(a>0&&!i)&&(s[0]=o[0],s[1]=o[1],!0)))}function n4(t,e){const{positive:i,negative:n,extendable_max:s,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(s&&l){const t=Math.max(n,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=n/i;h[0]=-h[1]*t}else{if(!s)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function s4(t,e){const{extendable_min:i,domain:n}=t,{extendable_max:s,domain:r}=e;return!(!i||!s)&&(n[0]=-n[1],r[1]=-r[0],!0)}J5.type=bn.mapLabel,J5.speckey="mapLabel";class r4{constructor(t=r4.Name){this.id=Co(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}}const a4=(t,e)=>t.map(((t,e)=>({index:e,value:t}))),o4=(t,e,i=0)=>{const n=new $t(t).expand(i/2),s=new $t(e).expand(i/2);return n.intersects(s)},l4=(t,e)=>{let i=0;t.x2Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function c4(t,e){for(let i,n=1,s=t.length,r=t[0];n{var n;const{labelStyle:s,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i,h=null!==(n=s.angle)&&void 0!==n?n:0,c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=l;c?u=0:d&&(u=Xo(-90));const p=wN(s),g=e.map(((i,n)=>{var r,l;const g=o?o(i):`${i}`,{width:f,height:v}=p.quickMeasure(g),m=Math.max(f,12),y=Math.max(v,12),_=t.scale(i);let b,x,S=Math.cos(u)*_,w=-Math.sin(u)*_;b=a&&c&&0===n?"left":a&&c&&n===e.length-1?"right":null!==(r=s.textAlign)&&void 0!==r?r:"center","right"===b?S-=m:"center"===b&&(S-=m/2),x=a&&d&&0===n?"top":a&&d&&n===e.length-1?"bottom":null!==(l=s.textBaseline)&&void 0!==l?l:"middle","bottom"===x?w-=y:"middle"===x&&(w-=y/2);return(new $t).set(S,w,S+m,w+y).rotate(h,S+m/2,w+y/2)}));return g},u4=(t,e)=>{var i,n,s,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===(n=null==e?void 0:e.currentAxis)||void 0===n?void 0:n.call(e);if(!l)return t;const h=null===(s=l.getTickData())||void 0===s?void 0:s.getDataView();if(!h)return t;const c=h.transformsArr.find((t=>"ticks"===t.type));if(!c)return t;const d=l.getScale();if(!d)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 p=o.getScale();if(!p)return t;const g=p.domain(),f=g[1]-g[0];if(0===f)return t;const v=d.domain(),m=v[1]-v[0];if(0===f)return t;const y=u.map((t=>{const e=(t.value-g[0])/f;return m*e+v[0]}));return a4(y,c.options)};class p4 extends r4{constructor(){super(p4.Name),this.Name="AxisSyncPlugin"}_checkEnableSync(t){if(!ol(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 n=this._getTargetAxis(e,i);n&&e.event.on(cK.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id},(()=>{((t,e)=>{const i=t.getScale(),n=e.getScale();if(!i||!n)return;if(!ol(i.type)||!ol(n.type))return;const s=[...i.domain()],r=[...n.domain()];if(!Q5(s)||!Q5(r))return;const a=t4(t,s),o=t4(e,r),{positive:l,negative:h,extendable_min:c,extendable_max:d,includeZero:u}=a,{positive:p,negative:g,extendable_min:f,extendable_max:v,includeZero:m}=o;if(0===l&&0===h){if(!i4(a,o))return}else if(0===p&&0===g){if(!i4(o,a))return}else if(u||m)if(u&&!m){if(!e4(a,o))return}else if(m&&!u){if(!e4(o,a))return}else{if(h===g)return;if(h>g){if(!n4(a,o))return}else if(!n4(o,a))return}else{if(0===h&&0===p){if(!s4(a,o))return}else if(0===g&&0===l&&!s4(o,a))return;if(0===h&&0===g)if(0===s[0]&&r[0]>0){if(!f)return;r[0]=0}else{if(!(0===r[0]&&s[0]>0))return;if(!c)return;s[0]=0}if(0===l&&0===p)if(0===s[1]&&r[1]>0){if(!v)return;r[1]=0}else{if(!(0===r[1]&&s[1]>0))return;if(!d)return;s[1]=0}}i.domain(s),n.domain(r)})(n,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const n=this._getTargetAxis(e,i);if(n&&i.tickAlign){hq(e.getOption().dataSet,"tickAlign",u4);const t={targetAxis:()=>n,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}var g4={AxisSyncPlugin:p4};const f4=t=>t,v4={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,n)=>(!n||!h4(i.AABBBounds,t.AABBBounds,e))&&(i=t,!0)))}},m4=(t,e,i,n,s,r)=>{let a=r,o=0,l=0,h=0,c=-1,d=Number.MAX_VALUE;do{let r=!0;a++;let u=0;do{u+a0);if(u===n){h=a,l=o;break}{const i=Math.floor(t.length/a)-o+1;if(i=0?l4(e[u-a],e[u])[t]:r,g=Math.abs(r-p);g{const{tickCount:i,forceTickCount:n,tickStep:s,getRadius:r,axisSpec:a,labelGap:o=0}=e,l=null==r?void 0:r();if(!l)return a4(t.domain());let c;if(h(s))c=t.stepTicks(s);else if(h(n))c=t.forceTicks(n);else if(h(i))c=t.ticks(i);else if(e.sampling){const i=t.domain(),n=t.range(),s=m1(a),r=((t,e,i)=>{var n;const{labelStyle:s,getRadius:r,axisSpec:a,labelFormatter:o}=i,l=null==r?void 0:r(),h=null!==(n=s.angle)&&void 0!==n?n:0,c=m1(a),d=wN(s),u=e.map((e=>{const i=o?o(e):`${e}`,{width:n,height:s}=d.quickMeasure(i),r=Math.max(n,12),a=Math.max(s,12),u=t.scale(e);let p=0,g=0;const f=tl(u),{x:v,y:m}=Qt({x:0,y:0},l+c,u);return p=v+("right"===f.align?-r:"center"===f.align?-r/2:0),g=m+("bottom"===f.baseline?-a:"middle"===f.baseline?-a/2:0),(new $t).set(p,g,p+r,g+a).rotate(h,p+r/2,g+a/2)}));return u})(t,i,e),h=Math.min(...n),d=Math.max(...n),u=Math.abs(d-h)*(l+s)/i.length,{step:p,delCount:g}=_4(i,r,o,Math.floor(r.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/u));c=t.stepTicks(p),c=c.slice(0,c.length-g)}else c=t.domain();return a4(c)},_4=(t,e,i,n)=>{let s=n;do{let n=!0;s++;let r=0;do{r+s2){let i=t.length-t.length%s;for(i>=t.length&&(i-=s);i>0&&o4(e[0],e[i]);)r++,i-=s}return{step:s,delCount:r}},b4=(t,e)=>{if(ol(t.type))return((t,e)=>{if(!ol(t.type))return a4(t.domain());const i=t.range();if(Math.abs(i[i.length-1]-i[0])<2)return a4([t.domain()[0]]);const{tickCount:n,forceTickCount:s,tickStep:r,noDecimals:a=!1}=e;let o;if(o=h(r)?t.stepTicks(r):h(s)?t.forceTicks(s):"d3"===e.tickMode?t.d3Ticks(null!=n?n:5,{noDecimals:a}):t.ticks(null!=n?n:5,{noDecimals:a}),e.sampling&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:n}=e;let s=d4(t,o,e).map(((t,e)=>({AABBBounds:t,value:o[e]})));for(;s.length>=3&&c4(s,i);)s=v4.parity(s);const r=s.map((t=>t.value));r.length<3&&n&&(r.length>1&&r.pop(),W(r)!==W(o)&&r.push(W(o))),o=r}return a4(o)})(t,e);if(hl(t.type)){if("cartesian"===e.coordinateType)return((t,e)=>{var i;const n=t.domain();if(!n.length)return[];const{tickCount:s,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l}=e,c=["bottom","top"].includes(l),d=t.range(),u=Math.abs(d[d.length-1]-d[0]);if(u<2)return e.labelLastVisible?a4([n[n.length-1]]):a4([n[0]]);let p;if(h(a))p=t.stepTicks(a);else if(h(r))p=t.forceTicks(r);else if(h(s))p=t.ticks(s);else if(e.sampling){let s;const r=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2;if(n.length<=u/r)s=d4(t,n,e);else{const i=[n[0],n[Math.floor(n.length/2)],n[n.length-1]],r=d4(t,i,e);let a=null,o=0;r.forEach(((t,e)=>{if(!a)return a=t,void(o=e);c?a.width()c?t.width():t.height())),l=Math.min(...d),h=(Math.max(...d)-l)/n.length,g=m4(n,s,o,e.labelLastVisible,c,Math.floor(Math.min(...a)/h));p=t.stepTicks(g.step),e.labelLastVisible&&(p=p.slice(0,p.length-g.delCount),p.push(n[n.length-1]))}else p=t.domain();return a4(p)})(t,e);if("polar"===e.coordinateType&&"angle"===e.axisOrientType)return y4(t,e)}return a4(t.domain())};class x4 extends D5{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(){return this._tickData}getStatisticsDomain(){return this._statisticsDomain}get visible(){return this._visible}constructor(t,e){var i;super(t,Object.assign({},e)),this._scales=[],this._statisticsDomain={domain:[],index:{}},this._visible=!0,this._tick=void 0,this.computeStatisticsDomain=()=>{const t=[];if(nl(this._regions,(e=>{var i;const n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e);n&&this.getSeriesStatisticsField(e).forEach((e=>{var i;(null===(i=n.latestData)||void 0===i?void 0:i[e])&&t.push(n.latestData[e])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._statisticsDomain.domain=this.computeDomain(t),!ol(this._scale.type)){this._statisticsDomain.index={};for(let t=0;t{var i;f(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:n}=this._spec;h(t)&&(this._seriesUserId=V(t)),h(i)&&(this._regionUserId=V(i)),h(e)&&(this._seriesIndex=V(e)),h(n)&&(this._regionIndex=V(n)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=sl(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()}))}updateScaleDomain(){}computeData(){this._tickData.getDataView().reRunAllTransform(),this._tickData.updateData()}initScales(){this._scales=[this._scale];const t=[];if(nl(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=Math.max(...t.map((t=>t.fields.length)));for(let t=1;t{JSON.stringify(e[i]),JSON.stringify(t[i])}))||i.reMake,i)}getLabelFormatMethod(){return this._spec.label.formatMethod?(t,e,i)=>this._spec.label.formatMethod(e.rawValue,e):null}getLabelItems(t){return f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value}))).filter((t=>t.value>=0&&t.value<=1))]:[]}_delegateAxisContainerEvent(t){const e=null==t?void 0:t.find((t=>t.name===dY.axisContainer),!0);e&&e.addEventListener("*",((e,i)=>this._delegateEvent(t,e,i)))}_getAxisAttributes(){var t,e,i,n,s,r,a,h,c,d,u;const p=this._spec;let g,f=p.title.angle;"left"!==p.orient&&"right"!==p.orient||(null===(t=p.title)||void 0===t?void 0:t.autoRotate)&&l(p.title.angle)&&(f="left"===p.orient?-90:90,g=v1[p.orient]);const v=L(p.label,["style","formatMethod","state"]);return{orient:this.getOrient(),select:p.select,hover:p.hover,line:(m=p.domainLine,(m=EN(m)).startSymbol=EN(m.startSymbol),m.endSymbol=EN(m.endSymbol),m),label:Object.assign({style:o(p.label.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.label.style(t.rawValue,e,t,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.label)||void 0===s?void 0:s.style,r)))}:ON(p.label.style),formatMethod:p.label.formatMethod?(t,e,i)=>p.label.formatMethod(e.rawValue,e):null,state:RN(p.label.state)},v),tick:{visible:p.tick.visible,length:p.tick.tickSize,inside:p.tick.inside,alignWithLabel:p.tick.alignWithLabel,style:o(p.tick.style)?(t,e,i,n)=>{var s;const r=this._prepareSpecAfterMergingTheme(p.tick.style(t,e,i,n));return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(s=this._theme.tick)||void 0===s?void 0:s.style,r)))}:ON(p.tick.style),state:PN(p.tick.state),dataFilter:p.tick.dataFilter},subTick:{visible:p.subTick.visible,length:p.subTick.tickSize,inside:p.subTick.inside,count:p.subTick.tickCount,style:o(p.subTick.style)?(t,e,i,n)=>{var s;const r=p.subTick.style(t,e,i,n);return ON(Lh({},null===(s=this._theme.subTick)||void 0===s?void 0:s.style,r))}:ON(p.subTick.style),state:PN(p.subTick.state)},grid:{type:"line",visible:p.grid.visible,alternateColor:p.grid.alternateColor,alignWithLabel:p.grid.alignWithLabel,style:o(p.grid.style)?(t,e)=>{var i,n;const s=p.grid.style(null===(i=t.datum)||void 0===i?void 0:i.rawValue,e,t.datum);return ON(this._prepareSpecAfterMergingTheme(Lh({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,s)))}:ON(p.grid.style)},subGrid:{type:"line",visible:p.subGrid.visible,alternateColor:p.subGrid.alternateColor,style:ON(p.subGrid.style)},title:{visible:p.title.visible,position:p.title.position,space:p.title.space,autoRotate:!1,angle:f?Kt(f):null,textStyle:Lh({},g,ON(p.title.style)),padding:p.title.padding,shape:{visible:null===(e=p.title.shape)||void 0===e?void 0:e.visible,space:null===(i=p.title.shape)||void 0===i?void 0:i.space,style:ON(null===(n=p.title.shape)||void 0===n?void 0:n.style)},background:{visible:null===(s=p.title.background)||void 0===s?void 0:s.visible,style:ON(null===(r=p.title.background)||void 0===r?void 0:r.style)},state:{text:PN(p.title.state),shape:PN(null===(a=p.title.shape)||void 0===a?void 0:a.state),background:PN(null===(h=p.title.background)||void 0===h?void 0:h.state)}},panel:{visible:null===(c=p.background)||void 0===c?void 0:c.visible,style:ON(null===(d=p.background)||void 0===d?void 0:d.style),state:PN(null===(u=p.background)||void 0===u?void 0:u.state)}};var m}addTransformToTickData(t,e){var i,n;null===(n=null===(i=this._tickData)||void 0===i?void 0:i.getDataView())||void 0===n||n.transform(t,e)}}x4.specKey="axes";const S4=[g4.AxisSyncPlugin];class w4 extends x4{getOrient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}getScales(){return this._scales}getStatisticsDomain(){return this._statisticsDomain}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianAxis,this.name=bn.cartesianAxis,this.layoutType="region-relative",this.layoutZIndex=PK.Axis,this.layoutLevel=RK.Axis,this._orient="left",this._scales=[],this._statisticsDomain={domain:[],index:{}},this._tick=void 0,this._layoutCache={width:0,height:0,_lastComputeOutBounds:{x1:0,x2:0,y1:0,y2:0}},this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):WK(this.getOrient())?t.setYAxisHelper(this.axisHelper()):GK(this.getOrient())&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},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"),n=VK(this.getOrient()),s=t=>{var e;return(n?!VK(t.orient):VK(t.orient))&&ol(t.getScale().type)&&(null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)))},r=i.filter((t=>s(t)));if(r.length){let a;if(h(t))a=r.find((e=>e.id===t));else if(h(e)){const t=i[e];s(t)&&(a=t)}else a=r[0];if(a){const t=this.getMarks()[0].getProduct(),e=a.valueToPosition(0);n?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-(a.getScale().range()[0]-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-(a.getScale().range()[1]-e)})})}}}},this._orient=UK(t,["z"]),GK(this._orient)&&(this.layoutType="absolute"),h(t.autoIndent)&&(this._autoIndent=t.autoIndent),this._layoutOrient=this._orient,this._dataSet=e.dataSet}static createAxis(t,e,i=!1){var n;const s=null!==(n=t.type)&&void 0!==n?n:function(t,e){return e?VK(t)?"linear":"band":VK(t)?"band":"linear"}(t.orient,i),r=`${w4.type}-${s}`,a=BN.getComponentInKey(r);if(a){let n=t.inverse;return i&&!VK(t.orient)&&(n=!h(t.inverse)||!t.inverse),new a(Object.assign(Object.assign({},t),{type:s,inverse:n}),e)}return e.onError(`Component ${r} not found`),null}static createComponent(t,e){if(!this.type.startsWith(w4.type))return null;if(e.getRegionsInIndex().find((t=>"cartesian"!==t.coordinate)))return null;let i=t[w4.specKey]||e.defaultSpec;if(!i)return null;const n=t.direction===HK.horizontal;if(!f(i))return _1(i)?w4.createAxis(i,e,n):null;const s=i.filter((t=>"z"===t.orient))[0];let r=!0;if(s){const t=i.filter((t=>"bottom"===t.orient))[0],e=i.filter((t=>WK(t.orient)))[0];r=3===i.length&&t&&e}r||(i=i.filter((t=>"z"!==t.orient)));const a=[];return i.forEach(((t,i)=>{_1(t)&&a.push(w4.createAxis(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:w4.specKey}),n))})),a}setLayout3dBox(t){this.layout3dBox=t}updateScaleRange(){let t=!1;const{width:e,height:i}=this.getLayoutRect(),n=this._spec.inverse;let s=[];VK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e]):GK(this.getOrient())?_(e)&&(s=n?[e,0]:[0,e],this._scale.range(s)):_(i)&&(s=n?[0,i]:[i,0]);const[r,a]=this._scale.range();return s[0]===r&&s[1]===a||(t=!0,this._scale.range(s)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(S4.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){super.setAttrFromSpec();VK(this.getOrient())?p(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):p(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}getSeriesStatisticsField(t){let e;return e=VK(this.getOrient())?t.fieldX:GK(this.getOrient())?t.fieldZ:t.fieldY,ol(this._scale.type)?e:[e[0]]}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._spec.inverse}}afterCompile(){var t;const e=null===(t=this.getMarks()[0])||void 0===t?void 0:t.getProduct();e&&e.addEventListener(NV.AFTER_ELEMENT_ENCODE,(()=>{!1===this._isLayout&&(VK(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._delegateAxisContainerEvent(e.getGroupGraphicItem()))})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onLayoutEnd(t){this.updateScaleRange()?this.event.emit(cK.scaleUpdate,{model:this}):this.updateSeriesScale(),super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return nl(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:VK(this.getOrient())?i.fieldX2?[...i.fieldX,i.fieldX2]:i.fieldX:GK(this.getOrient())?i.fieldZ:i.fieldY,a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{VK(this.getOrient())?(t.setScaleX(this._scale),t.setXAxisHelper(this.axisHelper())):WK(this.getOrient())?(t.setScaleY(this._scale),t.setYAxisHelper(this.axisHelper())):GK(this.getOrient())&&(t.setScaleZ(this._scale),t.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setLayoutStartPosition(t){let{x:e,y:i}=t;_(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),_(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),super.setLayoutStartPosition({x:e,y:i})}computeBoundsInRect(t){const e=super.computeBoundsInRect(t);if(!this._visible)return e;const i=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layoutOrient){case"left":0===this._layoutRectLevelMap.width&&(e.width=i.x1<0?-i.x1:0);break;case"right":0===this._layoutRectLevelMap.width&&(e.width=i.x2>0?i.x2:0);break;case"top":0===this._layoutRectLevelMap.height&&(e.height=i.y1<0?-i.y1:0);break;case"bottom":0===this._layoutRectLevelMap.height&&(e.height=i.y2>0?i.y2:0)}return e.width=Math.ceil(e.width),e.height=Math.ceil(e.height),this._setRectInSpec(this._layoutCacheProcessing(e))}boundsInRect(t){let e={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return e;this._verticalLimitSize=VK(this.getOrient())?t.height:t.width,this.setLayoutRect(t),this.updateScaleRange(),this.computeData();const i=VK(this.getOrient()),n={skipLayout:!1};i?this.pluginService&&this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,n,this)})):this.pluginService&&this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,n,this)}));const s=this.getMarks()[0].getProduct();this._latestBounds=s.getBounds();{const t=this._getUpdateAttribute(!0),i=s.getGroupGraphicItem().getBoundsWithoutRender(Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t));isFinite(i.width())&&(e=i,this._latestBounds=i)}return e}updateLayoutAttribute(){if(!this.visible)return;const t=this._getUpdateAttribute(!1),e=this.getMarks()[0].getProduct(),i=Lh(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t);e.encode(i),super.updateLayoutAttribute()}_getTitleLimit(t){var e,i,n,s,r;if(this._spec.title.visible&&l(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(n=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==n?n:null===(s=this._spec.title.style)||void 0===s?void 0:s.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,n=0;if(!t){const t=this.getRegions();let{x:e,y:s}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=s+t[0].getLayoutRect().height;for(let i=1;i{this._clearLayoutCache()})))}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this._lastComputeOutBounds[t]{const{min:i,max:n}=t;e[0]=void 0===e[0]?i:Math.min(e[0],i),e[1]=void 0===e[1]?n:Math.max(e[1],n)})),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=t[t.length-1];e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),h(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),h(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=y1(this._spec);if(h(e)||h(i)||"linear"!==this._spec.type)return t;if(Math.abs(G(t)-function(t){if(t&&f(t))return t.reduce(((t,e)=>Math.max(t,e)),-1/0)}(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[1]=1;else{let i=e/5;const n=Math.floor(Math.log(i)/Math.LN10),s=i/Math.pow(10,n);i=(s>=A4?10:s>=k4?5:s>=M4?2:1)*Math.pow(10,n),t[0]=0,t[1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[1]*=-1)}return t}niceMinMax(){var t,e,i,n,s,r,a,o;if(this._nice){let c=null!==(e=null!==(t=this._tick.forceTickCount)&&void 0!==t?t:this._tick.tickCount)&&void 0!==e?e:10;"accurateFirst"===this._spec.niceType&&(c=Math.max(10,c)),l(null===(i=this._domain)||void 0===i?void 0:i.min)&&l(null===(n=this._domain)||void 0===n?void 0:n.max)?this._scale.nice(c):h(null===(s=this._domain)||void 0===s?void 0:s.min)&&l(null===(r=this._domain)||void 0===r?void 0:r.max)?this._scale.niceMax(c):l(null===(a=this._domain)||void 0===a?void 0:a.min)&&h(null===(o=this._domain)||void 0===o?void 0:o.max)&&this._scale.niceMin(c)}}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(t[t.length-1],0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this.niceMinMax(),this.event.emit(cK.scaleUpdate,{model:this})}extendDomain(t){let e;const i=t.length-1,n=t[0]-t[i]>0,s=n?i:0,r=n?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const n=Math.min(t.length,this._scales.length);for(let i=0;ithis._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:e=>t(e).bandwidth(),getStatisticsDomain:()=>this.getStatisticsDomain(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._spec.inverse}}dataToPosition(t,e={}){var i;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:s}=this.getPosition(t);return n+s.bandwidth()*(null!==(i=e.bandPosition)&&void 0!==i?i:.5)}transformScaleDomain(){}}P4.type=bn.cartesianBandAxis,N(P4,E4);class R4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{VK(this.getOrient())?t.setXAxisHelper(this.axisHelper()):t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Lh({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t,e,i,n,s,r,a;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=this._spec.label||{},o=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:null===(i=null===(e=this._spec.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.tickCount,forceTickCount:null===(s=null===(n=this._spec.layers)||void 0===n?void 0:n[1])||void 0===s?void 0:s.forceTickCount,tickStep:null===(a=null===(r=this._spec.layers)||void 0===r?void 0:r[1])||void 0===a?void 0:a.tickStep,axisOrientType:this._orient,coordinateType:"cartesian",labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,labelLastVisible:t.lastVisible,labelFlush:t.flush}},!1);this._layerTickData=new jZ(this._option,o)}}computeData(){super.computeData(),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}getLabelFormatMethod(){var t,e,i,n,s,r,a,o,l,h,c,d;const u=fo.getInstance(),p=(null===(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.layers)||void 0===e?void 0:e[1])||void 0===i?void 0:i.timeFormat)||"%Y%m%d",g="local"===((null===(r=null===(s=null===(n=this._spec)||void 0===n?void 0:n.layers)||void 0===s?void 0:s[1])||void 0===r?void 0:r.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat,f=(null===(l=null===(o=null===(a=this._spec)||void 0===a?void 0:a.layers)||void 0===o?void 0:o[0])||void 0===l?void 0:l.timeFormat)||"%Y%m%d",v="local"===((null===(d=null===(c=null===(h=this._spec)||void 0===h?void 0:h.layers)||void 0===c?void 0:c[0])||void 0===d?void 0:d.timeFormatMode)||"local")?u.timeFormat:u.timeUTCFormat;return(t,e,i,n,s)=>{var r;let a;return a=0===s?v(f,t):g(p,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){const e=[];return f(this._tickData.getLatestData())&&e.push(this._tickData.getLatestData().map((e=>({id:e.value,label:e.value,value:0===t?0:this.dataToPosition([e.value])/t,rawValue:e.value})))),this._layerTickData&&f(this._layerTickData.getLatestData())&&e.push(this._layerTickData.getLatestData().map((e=>{const i=this.dataToPosition([e.value]);return{id:e.value,label:e.value,value:i/t,rawValue:e.value}}))),e}transformScaleDomain(){}}R4.type=bn.cartesianTimeAxis;class O4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianLogAxis,this._zero=!1,this._scale=new Ql}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10)}transformScaleDomain(){}}O4.type=bn.cartesianLogAxis,N(O4,C4);class B4 extends T4{constructor(){super(...arguments),this.type=bn.cartesianSymlogAxis,this._zero=!1,this._scale=new rh}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}transformScaleDomain(){}}B4.type=bn.cartesianSymlogAxis,N(B4,C4);class I4 extends x4{constructor(){super(...arguments),this.type=bn.polarAxis,this.name=bn.polarAxis,this.layoutType="absolute",this.layoutZIndex=PK.Axis,this._tick=void 0,this._center=null,this._startAngle=tV,this._endAngle=eV,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:()=>{this.computeData(),nl(this._regions,(t=>{"radius"===this.getOrient()?t.radiusAxisHelper=this.axisHelper():t.angleAxisHelper=this.axisHelper()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getGroupScales(){return this._groupScales}setRefAngleAxis(t){return this._refAngleAxis=t,this}static createAxis(t,e){var i;const n=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",s=`${I4.type}-${n}`,r=BN.getComponentInKey(s);return r?new r(Object.assign(Object.assign({},t),{type:n}),e):(e.onError(`Component ${s} not found`),null)}static createComponent(t,e){var i,n;if(!this.type.startsWith(I4.type))return null;const s=t.axes||e.defaultSpec;if(!s)return null;if(!f(s))return b1(s)?(s.center=t.center,s.startAngle=null!==(i=t.startAngle)&&void 0!==i?i:iV,s.endAngle=null!==(n=t.endAngle)&&void 0!==n?n:h(t.startAngle)?t.startAngle+360:nV,I4.createAxis(s,Object.assign(Object.assign({},e),{specKey:"axes"}))):null;const r=[];let a;const o=[];return s.forEach(((i,n)=>{var s,l,c,d,u;if(!b1(i))return;i.center=t.center,i.startAngle=null!==(s=t.startAngle)&&void 0!==s?s:iV,i.endAngle=null!==(l=t.endAngle)&&void 0!==l?l:h(t.startAngle)?t.startAngle+360:nV,i.outerRadius=null!==(u=null!==(d=null!==(c=i.radius)&&void 0!==c?c:t.outerRadius)&&void 0!==d?d:t.radius)&&void 0!==u?u:sV;const p=I4.createAxis(i,Object.assign(Object.assign({},e),{specIndex:n,specKey:"axes"}));r.push(p),"radius"===i.orient?o.push(p):a=p})),o.forEach((t=>t.setRefAngleAxis(a))),r}setAttrFromSpec(){var t,e;super.setAttrFromSpec();const i=this._getAxisAttributes();this._axisStyle=i,this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center;const n=this.getChart().getSpec(),s=null!==(t=this._spec.startAngle)&&void 0!==t?t:n.startAngle,r=null!==(e=this._spec.endAngle)&&void 0!==e?e:n.endAngle;this._startAngle=Xo(null!=s?s:iV),this._endAngle=Xo(null!=r?r:h(s)?s+360:nV)}setLayoutStartPosition(t){var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0],n=i?i.getLayoutStartPoint():t;super.setLayoutStartPosition(n)}onLayoutEnd(t){this.updateScaleRange(),this.updateSeriesScale(),this.event.emit(cK.scaleUpdate,{model:this}),super.onLayoutEnd(t)}onRender(t){}changeRegions(){}_initData(){cq(this._option.dataSet,"scale",f4),hq(this._option.dataSet,"ticks",b4);const t=this._spec.label||{},e=this._spec.tick||{},i=new go(this._option.dataSet).parse(this._scale,{type:"scale"}).transform({type:"ticks",options:{sampling:!1!==this._spec.sampling,tickCount:e.tickCount,forceTickCount:e.forceTickCount,tickStep:e.tickStep,tickMode:e.tickMode,noDecimals:e.noDecimals,coordinateType:"polar",axisOrientType:this._orient,startAngle:this.startAngle,labelStyle:t.style,labelFormatter:t.formatMethod,labelGap:t.minGap,axisSpec:this._spec,getRadius:()=>this.getOuterRadius()}},!1);i.target.addListener("change",this._forceLayout.bind(this)),this._tickData=new jZ(this._option,i)}initEvent(){super.initEvent(),this.visible&&this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateAxisContainerEvent(i.getGroupGraphicItem())}))}updateScaleRange(){const t=this._spec.inverse;"radius"===this.getOrient()?this._scale.range(t?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]):this._scale.range(t?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle])}collectData(t){const e=[];return nl(this._regions,(i=>{var n,s,r;let a;a=t>0?null===(s=null===(n=i.getGroups())||void 0===n?void 0:n.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?i.getRadiusField():i.getAngleField(),a=f(a)?ol(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=i.getFieldAlias(a[0]));const o=null===(r=i.getViewDataStatistics)||void 0===r?void 0:r.call(i);a&&a.forEach((t=>{var i;(null===(i=null==o?void 0:o.latestData)||void 0===i?void 0:i[t])&&e.push(o.latestData[t])}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),e}updateSeriesScale(){nl(this._regions,(t=>{"radius"===this.getOrient()?(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):(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 ol(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ol(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),getScale:t=>this._scales[t],getAxisId:()=>this.id}}dataToPosition(t){return this._scale.scale(t)}positionToData(t){const e=this.pointToCoord(t);if("radius"===this.getOrient())return this._scale.invert(e.radius);if("band"===this._scale.type){const t=this._scale.range(),i=t[t.length-1]-t[0];if(t[0]<0){const n=(e.angle+this._scale.bandwidth()/2+Math.abs(t[0]))%i-Math.abs(t[0]);return this._scale.invert(n)}return this._scale.invert((e.angle+this._scale.bandwidth()/2)%i)}return this._scale.invert(e.angle)}coordToPoint(t){const e=t.angle,{x:i,y:n}=this.getCenter(),s=$o({angle:e,radius:t.radius});return{x:s.x+i,y:s.y+n}}pointToCoord(t){const{x:e,y:i}=this.getCenter();let n=t.x-e,s=t.y-i;const r=this._startAngle,a=this._endAngle,o=Math.sqrt(n*n+s*s);n/=o,s/=o;let l=Math.atan2(s,n);if(la)for(;l>=a;)l-=2*Math.PI;return{radius:o,angle:l}}getCenter(){var t,e;return{x:(null===(t=this._center)||void 0===t?void 0:t.x)||this.getRefLayoutRect().width/2,y:(null===(e=this._center)||void 0===e?void 0:e.y)||this.getRefLayoutRect().height/2}}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}tickValues(){return this._tickData.getLatestData()||[]}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_layoutAngleAxis(){const t=this.getCenter(),e=this.computeLayoutOuterRadius(),i=this.computeLayoutInnerRadius(),n=this._endAngle-this._startAngle,s=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:t,radius:e,innerRadius:i,startAngle:this._startAngle,endAngle:this._endAngle,grid:{type:"line",smoothLink:!0},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-this._startAngle)/n,rawValue:t.value}}))]:[]});this._update(s)}_layoutRadiusAxis(){var t;const e=this.getCenter(),i=this.computeLayoutOuterRadius(),n=this.computeLayoutInnerRadius(),s=this.coordToPoint({angle:this._startAngle,radius:i}),r=this.coordToPoint({angle:this._startAngle,radius:n}),a=Ut.distancePP(r,s),o=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:r,end:s,verticalFactor:-1,grid:{type:(null===(t=this._spec.grid)||void 0===t?void 0:t.smooth)?"circle":"polygon",center:e,closed:!0,sides:this._refAngleAxis.tickValues().length,startAngle:this._startAngle,endAngle:this._endAngle},title:{text:this._spec.title.text||this._dataFieldText},items:f(this._tickData.getLatestData())?[this._tickData.getLatestData().map((t=>{const e=this.dataToPosition([t.value]);return{id:t.value,label:t.value,value:(e-n)/a,rawValue:t.value}}))]:[]});this._update(o)}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius,{width:n,height:s}=this.getRefLayoutRect();return Math.min(n,s)/2*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius,{width:i,height:n}=this.getRefLayoutRect();return Math.min(i,n)/2*e}getRefLayoutRect(){return this.getRegions()[0].getLayoutRect()}getRefSeriesRadius(){let t=sV,e=0;const i=this.getChart().getSpec();return nl(this.getRegions(),(n=>{const s=n;if(function(t){return[Fh.rose,Fh.radar,Fh.circularProgress].includes(t)}(s.type)){const{outerRadius:n=i.outerRadius,innerRadius:r=i.innerRadius}=s;_(n)&&(t=n),_(r)&&(e=r)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){this.getMarks()[0].getProduct().encode(Lh({},this._axisStyle,t))}}I4.type=bn.polarAxis;class D4 extends I4{constructor(){super(...arguments),this.type=bn.polarLinearAxis,this._zero=!0,this._nice=!0,this._scale=new Zl}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}}D4.type=bn.polarLinearAxis,N(D4,C4);class L4 extends I4{constructor(){super(...arguments),this.type=bn.polarBandAxis,this._scale=new Pl}computeDomain(t){return this.computeBandDomain(t)}dataToPosition(t){if(0===t.length||0===this._scales.length)return 0;const{position:e}=this.getPosition(t);return e}updateScaleRange(){super.updateScaleRange(),this.updateGroupScaleRange()}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(0,0)}transformScaleDomain(){}}L4.type=bn.polarBandAxis,N(L4,E4);const F4=(t,e)=>{const i=[],n={},{series:s,seriesField:r}=e;return s().forEach((t=>{const e=r(t);let s;s=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),s.forEach((t=>{n[t.key]||(n[t.key]=!0,i.push(t))}))})),i},j4=(t,e)=>{var i,n,s;const{selected:r,field:a,data:o}=e,l=r(),c=o();if(0===l.length&&c.length)return[];if(l.length===c.length)return t;const d={};l.forEach((t=>{d[t]=!0}));const u=null!==(i=a())&&void 0!==i?i:vK;return f(t)&&(null===(n=t[0])||void 0===n?void 0:n.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(s=t[0])||void 0===s?void 0:s.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):h(u)&&(t=t.filter((t=>!0===d[t[u]]))),t};class z4 extends D5{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=PK.Legend,this.layoutLevel=RK.Legend,this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{nl(this._regions,(t=>{var e;null===(e=t.getViewDataFilter())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nl(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}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=Sh(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:n,seriesIndex:s}=this._spec;h(n)&&(this._seriesUserId=V(n)),h(e)&&(this._regionUserId=V(e)),h(s)&&(this._seriesIndex=V(s)),h(i)&&(this._regionUserIndex=V(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return i.reRender=!0,t.orient!==e.orient?(i.reMake=!0,i):i}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=[...this._selectedData],this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new jZ(this._option,t),this._initSelectedData(),nl(this._regions,(t=>{t.event.on(cK.rawDataStatisticsUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,n;const s=this._selectedData;l(t)||JSON.stringify(s)===JSON.stringify(t)||(this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(cK.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),this._legendComponent){const{x:e,y:i}=t;_(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}boundsInRect(t,e){if(!this._visible)return{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},n=this._getLegendAttributes(t);if(this._legendComponent)z(n,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},n,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Lh({},n,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=n;const s=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0,a="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",o=this._position,{width:l,height:h}=e;let c=0,d=0;return"horizontal"===a?"middle"===o?c=(l-s)/2:"end"===o&&(c=l-s):"middle"===o?d=(h-r)/2:"end"===o&&(d=h-r),this._legendComponent.setAttributes({dx:c,dy:d}),i.x2=i.x1+s,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());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Lh({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(cK.legendSelectedDataChange,{model:this})}}clear(){var t;this._legendComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._legendComponent),this._legendComponent=null),this._cacheAttrs=null,this._preSelectedData=null,super.clear()}}class H4 extends z4{constructor(){super(...arguments),this.type=bn.discreteLegend,this.name=bn.discreteLegend}static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return i.type&&"discrete"!==i.type?void 0:new H4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"}));const n=[];return i.forEach(((t,i)=>{t.type&&"discrete"!==t.type||n.push(new H4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}init(t){super.init(t),nl(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this._legendData.getLatestData().map((t=>t.key))}})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){hq(this._option.dataSet,"discreteLegendFilter",j4),hq(this._option.dataSet,"discreteLegendDataMake",F4);const t=new go(this._option.dataSet);return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nl(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;const n=t.getSeriesField();if(!this._spec.scaleName)return n;if(!t.getRawData())return n;const s=this._option.globalScale.getScaleSpec(this._spec.scaleName);if(!s)return n;if(this._spec.field)return this._spec.field;if(!Eo(s.domain))return n;const r=s.domain.find((e=>e.dataId===t.getRawData().name));return r&&null!==(i=null===(e=r.fields)||void 0===e?void 0:e[0])&&void 0!==i?i:n}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData().map((t=>t.key))}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!e)return;t.title.text=MN(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},function(t,e){const i=Lh({},t),{title:n={},item:s={},pager:r={},background:a={},type:o,id:l,visible:c,orient:d,position:u,data:p,filter:g,regionId:f,regionIndex:v,seriesIndex:m,seriesId:y,padding:_}=i,b=vn(i,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return n.visible&&(b.title=O5(n)),C(s.focusIconStyle)||ON(s.focusIconStyle),s.shape=EN(s.shape),s.label=EN(s.label),s.value=EN(s.value),s.background=EN(s.background),Ah(s.maxWidth)&&(s.maxWidth=Number(s.maxWidth.substring(0,s.maxWidth.length-1))*e.width/100),Ah(s.width)&&(s.width=Number(s.width.substring(0,s.width.length-1))*e.width/100),Ah(s.height)&&(s.height=Number(s.height.substring(0,s.height.length-1))*e.width/100),b.item=s,C(r.textStyle)||ON(r.textStyle),EN(r.handler),b.pager=r,a.visible&&!C(a.style)&&(Lh(b,a.style),h(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),i}_getLegendConstructor(){return sX}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(QY.legendItemClick,(e=>{const i=T(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(cK.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(QY.legendItemHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(QY.legendItemUnHover,(t=>{const e=T(t,"detail");this.event.emit(cK.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e;const i=t.style("fill")||t.style("stroke"),n=t.style("stroke"),s=t.style("lineWidth"),r=t.style("symbolType"),a=t.style("fillOpacity"),o=t.style("strokeOpacity"),l=t.style("opacity"),h=t.style("texture"),c=t.style("textureColor"),d=t.style("outerBorder"),u=t.style("innerBorder");return{label:t.key,shape:{fill:i,symbolType:null!==(e=null!=r?r:t.shapeType)&&void 0!==e?e:"circle",stroke:0===s||i===n?null:n,fillOpacity:_(a)?a:1,strokeOpacity:_(o)?o:1,opacity:_(l)?l:1,texture:h,texturePadding:h?1:null,textureSize:h?4:null,textureColor:c,innerBorder:u,outerBorder:d}}}));return o(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}}H4.type=bn.discreteLegend;const N4=(t,e)=>{const{series:i,field:n,scale:s}=e,r=n();if(n&&r){let t=Number.MAX_VALUE,e=Number.MIN_VALUE;return i().forEach((i=>{var n,s;const a=i.getRawDataStatistics().latestData,o=null===(n=null==a?void 0:a[r])||void 0===n?void 0:n.min,l=null===(s=null==a?void 0:a[r])||void 0===s?void 0:s.max;_(o)&&(t=o),_(l)&&(e=l)})),[t,e]}if(s){const t=s();return t?t.domain():[]}return[]},V4=(t,e)=>{const{selected:i,field:n,data:s}=e,r=i(),a=n();if(r===s())return t;if(a&&!C(r)){const[e,i]=r;return t.filter((t=>t[a]>=e&&t[a]<=i))}return t};function W4(t){return"color"===t||"size"===t}const G4={color:hX,size:dX},U4=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],Y4=[2,10];class X4 extends z4{static createComponent(t,e){const i=t.legends||e.defaultSpec;if(!i)return;if(!f(i))return W4(i.type)?new X4(i,Object.assign(Object.assign({},e),{specIndex:0,specKey:"legends"})):void 0;const n=[];return i.forEach(((t,i)=>{W4(t.type)&&n.push(new X4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"legends"})))})),n}constructor(t,e){super(t,e),this.type=bn.colorLegend,this.name=bn.colorLegend;const i="color"===this._spec.type?bn.colorLegend:bn.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),nl(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData()}})}),{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(){hq(this._option.dataSet,"continuousLegendFilter",V4),hq(this._option.dataSet,"continuousLegendDataMake",N4);const t=new go(this._option.dataSet);return t.transform({type:"continuousLegendDataMake",options:{series:()=>this._regions.reduce(((t,e)=>(t.push(...e.getSeries()),t)),[]),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,n,s;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&l(t.title.text)&&l(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(s=null===(n=this._regions)||void 0===n?void 0:n[0])||void 0===s?void 0:s.getSeries()[0];if(!i)return;return void(t.title.text=MN(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Eo(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=MN(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s="horizontal"===n?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),C(r)&&(r="color"===this._legendType?U4:Y4);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign(Object.assign({},function(t){const e=Lh({},t),{title:i={},handler:n={},rail:s={},track:r={},startText:a,endText:o,handlerText:l,sizeBackground:c,background:d={},type:u,id:p,visible:g,orient:f,position:v,data:m,defaultSelected:y,field:_,filter:b,regionId:x,regionIndex:S,seriesIndex:w,seriesId:A,padding:k}=e,M=vn(e,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return i.visible&&(M.title=O5(i)),M.showHandler=!1!==n.visible,C(n.style)||(M.handlerStyle=ON(n.style)),h(s.width)&&(M.railWidth=s.width),h(s.height)&&(M.railHeight=s.height),C(s.style)||(M.railStyle=ON(s.style)),C(r.style)||(M.trackStyle=ON(r.style)),M.startText=EN(a),M.endText=EN(o),M.handlerText=EN(l),C(c)||(M.sizeBackground=ON(c)),d.visible&&!C(d.style)&&(Lh(M,d.style),h(d.padding)&&(M.padding=d.padding)),M}(this._spec)),{layout:n,align:s,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r});return this._addDefaultTitleText(c),c}_getLegendConstructor(){return G4[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",vt((e=>{const i=T(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(cK.legendFilter,{model:this,value:i,event:e})}),30))}}}X4.type=bn.continuousLegend;const $4=(t,e)=>{const{datum:i,title:n,content:s}=e,r=[],a=i.call(null);return n.visible&&r.push({type:"title",index:0,datum:a,spec:n}),V(s).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class K4 extends D5{constructor(){super(...arguments),this.type=bn.indicator,this.name=bn.indicator,this.layoutType="absolute",this.layoutZIndex=PK.Indicator,this.layoutLevel=RK.Indicator,this._gap=0,this._activeDatum=null}static createComponent(t,e){if(this.type!==K4.type)return null;const i=V(t.indicator||e.defaultSpec).filter((t=>t&&!1!==t.visible)).map(((t,i)=>new K4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:K4.speckey}))));return i}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=V(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(V(this._spec.regionId),V(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("hovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unhovered",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))):(this.event.on("selected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(t.value[0])})),this.event.on("unselected",(t=>{t.model&&!this.isRelativeModel(t.model)||this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){hq(this._option.dataSet,"indicatorFilter",$4);const t=new go(this._option.dataSet);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 jZ(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect(),{x:n,y:s}=t.getLayoutStartPoint(),r=[];return V(this._spec.content).forEach((t=>{const e=Lh({},this._theme.content,t);r.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,style:Object.assign(Object.assign({},ON(e.style)),{text:this._createText(e.field,e.style.text)})})})),{visible:!1!==this._spec.visible&&(!1!==this._spec.fixed||null!==this._activeDatum),size:{width:e,height:i},zIndex:this.layoutZIndex,x:n,y:s,dx:this._spec.offsetX?Eh(this._spec.offsetX,this._computeLayoutRadius()):0,dy:this._spec.offsetY?Eh(this._spec.offsetY,this._computeLayoutRadius()):0,limitRatio:this._spec.limitRatio||1/0,title:{visible:!1!==this._spec.title.visible&&(!h(this._spec.title.field)||null!==this._activeDatum),space:this._spec.title.space||this._gap,autoLimit:this._spec.title.autoLimit,autoFit:this._spec.title.autoFit,fitPercent:this._spec.title.fitPercent,style:Object.assign(Object.assign({},ON(this._spec.title.style)),{text:this._createText(this._spec.title.field,this._spec.title.style.text)})},content:r}}_createOrUpdateIndicatorComponent(t){if(this._indicatorComponent)z(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gX(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}return this._cacheAttrs=t,this._indicatorComponent}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":o(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 nl(this._regions,(e=>t===e))||this._regions.includes(t)}clear(){var t;this._indicatorComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._indicatorComponent),this._indicatorComponent=null),this._cacheAttrs=null,super.clear()}}K4.speckey="indicator",K4.type=bn.indicator;class q4 extends D5{get orient(){return this._orient}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._orient=t,this._layoutOrient=t}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.title,this.layoutType="normal",this.layoutZIndex=PK.Title,this.layoutLevel=RK.Title,this._orient="top",this._orient=Sh(t.orient)?t.orient:"top",this._layoutOrient=this._orient}static createComponent(t,e){const i=t.title;if(!i||!1===i.visible)return null;if(!f(i))return new q4(i,Object.assign(Object.assign({},e),{specKey:"title"}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new q4(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"title"})))})),n}onRender(t){}updateSpec(t){const e=this._originalSpec,i=super.updateSpec(t);return e.orient!==t.orient&&(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}setLayoutStartPosition(t){const{x:e,y:i}=t;_(e)&&this._titleComponent&&this._titleComponent.setAttribute("x",e),_(i)&&this._titleComponent&&this._titleComponent.setAttribute("y",i),super.setLayoutStartPosition({x:e,y:i})}boundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:n,y:s}=this.getLayoutStartPoint();return{x1:n,y1:s,x2:n+e.width,y2:s+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:_(t.width())?t.width():0,height:this._spec.height?this._spec.height:_(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,n,s,r,a;const o=Math.max(0,null!==(t=this._spec.width)&&void 0!==t?t:this.getLayoutRect().width);return{text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtext:null!==(i=this._spec.subtext)&&void 0!==i?i:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,width:o,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:this._spec.maxWidth,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(r=this._spec.align)&&void 0!==r?r:"left",verticalAlign:null!==(a=this._spec.verticalAlign)&&void 0!==a?a:"top",textStyle:Object.assign({width:o},this._spec.textStyle),subtextStyle:Object.assign({width:o},this._spec.subtextStyle)}}_createOrUpdateTitleComponent(t){if(this._titleComponent)z(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uX(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}clear(){var t;this._titleComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._titleComponent),this._titleComponent=null),this._cacheAttrs=null,super.clear()}}q4.type=bn.title;class Z4{constructor(t){this.projection=F1(t.type)()}fit(t,e,i){const n={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],n)}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,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.scale)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.scale)||void 0===i||i.call(e,t)}translate(t){var e,i,n,s;if(void 0===t)return null===(s=null===(n=this.projection)||void 0===n?void 0:n.translate)||void 0===s?void 0:s.call(n);null===(i=null===(e=this.projection)||void 0===e?void 0:e.translate)||void 0===i||i.call(e,t)}evaluate(t,e,i){const n=this.projection.copy();return null==n?void 0:n.fitExtent([t,e],{type:"FeatureCollection",features:i})}}function J4(t,e){return`${IN}_${e}_${t}`}class Q4 extends D5{constructor(){super(...arguments),this.type=bn.geoCoordinate,this.name=bn.geoCoordinate,this.layoutType="absolute",this._projectionSpec={name:J4(this.type,this.id),type:"mercator"},this._actualScale=1,this._evaluated=!1,this._lastHeight=0,this._lastWidth=0,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,n,s,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===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min,l=(null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.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),e&&(e.zoomDelta=l),this.zoom(l,[t.zoomX,t.zoomY]),l},this.pan=(t=[0,0])=>{var e,i,n;const s=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=s[0],a=s[1];r+=t[0],a+=t[1],null===(n=this._projection)||void 0===n||n.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})}getScale(){return this._actualScale}static createComponent(t,e){if(l(t))return null;const i=[];return t.region.forEach(((t,n)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0}),r=new Q4(s,e);r._regions=e.getRegionsInIndex([n]),i.push(r)}})),i}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=Lh(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._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),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},n=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==n&&this.event.emit("zoom",{scale:n,scaleCenter:i,model:this})}initEvent(){this.event.on(cK.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this)),this._spec.roam&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,(()=>!0),this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){this._projection=new Z4(this._projectionSpec),null!==this._projection.projection||this._option.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===Fh.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.x}return this.dataToLongitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.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 n;let s=t[0];if(l(s)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];s=null===(n=this._centerCache.get(t))||void 0===n?void 0:n.y}return this.dataToLatitude(s)},valueToPosition:(t,i)=>{var n;if(l(t)&&(null==i?void 0:i.datum)){const s=i.datum[e.getDimensionField()[0]];t=null===(n=this._centerCache.get(s))||void 0===n?void 0:n.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect();if(this._evaluated){const t=(e-this._lastWidth)/2,n=(i-this._lastHeight)/2;this.pan([t,n]),this.event.emit("panmove",{delta:[t,n],model:this})}else{const{translate:t,scale:n,center:s}=this.evaluateProjection([0,0],[e,i]);t&&this._projection.translate(t),n&&this._projection.scale(n),s&&this._projection.center(s),this._evaluated=!0}this._lastWidth=e,this._lastHeight=i,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,n;e.type===Fh.map&&t.push(...null!==(n=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==n?n:[])}))})),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,n,s,r,a,o;let l=null!==(n=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==n?n:0;const h=null!==(r=null===(s=this._projection)||void 0===s?void 0:s.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 n=this._projection.evaluate(t,e,this.collectFeatures());let s=n.translate();const r=n.scale()*(null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1),a=this._projectionSpec.center;return a&&(s=[e[0]/2,e[1]/2]),{translate:s,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[Y1],{centroidX:n,centroidY:s}=e;i&&h(n*s)&&this._centerCache.set(i,{x:n,y:s})}))}}))}))}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}Q4.type=bn.geoCoordinate,N(Q4,d3);const t8={[t.RenderModeEnum["desktop-browser"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["desktop-miniApp"]]:{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum["mobile-browser"]]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.miniApp]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"},[t.RenderModeEnum.lynx]:{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}},e8={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class i8 extends D5{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,Object.assign({},e)),this.layoutType="absolute",this.gridZIndex=PK.CrossHair_Grid,this.labelZIndex=PK.CrossHair,this.trigger="hover",this.triggerOff="hover",this._handleEvent=mt((t=>{const{event:e}=t,i=e.viewX-this.getLayoutStartPoint().x,n=e.viewY-this.getLayoutStartPoint().y;this.showDefault=!1,this._layoutCrosshair(i,n)}),10),this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:n}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getCanvasRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:n}}return this._limitBounds}setAttrFromSpec(){super.setAttrFromSpec(),this._crosshairConfig=this._spec,this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}_initEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach(((t,i)=>this._registerEvent(t,f(e)?e[i]:e))):this._registerEvent(t,e)}}_registerEvent(t,e){this.event.on(t,{source:dK.chart},this._handleEvent),this.event.on(e,{level:uK.chart},((...t)=>{this.enableRemain||this.hide()}))}_eventOff(t){this.event.off(t,this._handleEvent)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option;if(t8[e]){const t=this.trigger||"hover",i=t=>"click"===t?"clickOut":"hoverOut";if(f(t)){let n=[],s=[];return t.forEach((t=>{n=n.concat(t8[e][t]),s=s.concat(t8[e][i(t)])})),{in:n,out:s}}return{in:t8[e][t],out:t8[e][i(t)]}}return null}_getAxisInfoByField(t){var e,i;const n=null===(i=null===(e=this._option)||void 0===e?void 0:e.getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==n?void 0:n.length))return null;let s=T(this._spec,`${t}Field.bindingAxesIndex`);if(s||(s=[],n.forEach(((e,i)=>{e8[t].includes(e.getOrient())&&s.push(i)}))),!s.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 s.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=n.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{a=Math.min(a,t.getLayoutStartPoint().x-c),o=Math.min(o,t.getLayoutStartPoint().y-d),l=Math.max(l,t.getLayoutStartPoint().x+t.getLayoutRect().width-c),h=Math.max(h,t.getLayoutStartPoint().y+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){if(this._getTriggerEvent()){const{in:t,out:e}=this._getTriggerEvent();f(t)?t.forEach((t=>this._eventOff(t))):this._eventOff(t),f(e)?e.forEach((t=>this._eventOff(t))):this._eventOff(e)}}_firstSeries(){for(let t=0;t{const r=n.axis;var a,o,l;if(o=e,l=i,((a=n).x1>o||a.x2l||a.y2a||o{(t.xField||t.yField)&&n.push(new r8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.cartesianCrosshair,this.name=bn.cartesianCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){if(!this.showDefault)return;const{xField:t={},yField:e={}}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this.defaultCrosshair(e,i,n8.VERTICAL,!0),this.layoutByValue(n8.VERTICAL)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this.defaultCrosshair(t,i,n8.HORIZONTAL,!1),this.layoutByValue(n8.HORIZONTAL)}}defaultCrosshair(t,e,i,n){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(n?(this.currValueX.clear(),this.currValueX.set(t,{axis:s,v:e})):(this.currValueY.clear(),this.currValueY.set(t,{axis:s,v:e})))}findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),n=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getValueAt(t,e){let i=t.getScale().invert(e);return ol(t.getScale().type)&&_(+i)&&(i=(+i).toFixed(2)),i}clearAxisValue(){this.currValueX.clear(),this.currValueY.clear()}setAxisValue(t,e){VK(e.getOrient()),this.currValueX.set(e.getSpecIndex(),{v:t,axis:e})}getAllAxisValues(t,e,i,n){let s=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const r=t.axis;i.set(s,{v:this.getValueAt(r,e-(n?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(i&&0===i.size&&n&&0===n.size){if(this.enableRemain)return;this.hide()}else this.currValueX.clear(),this.currValueY.clear(),i&&i.size&&this.getAllAxisValues(i,t,this.currValueX,!0),n&&n.size&&this.getAllAxisValues(n,e,this.currValueY,!1),this.layoutByValue(n8.ALL)}hide(){this._xCrosshair&&this._xCrosshair.hideAll(),this._xTopLabel&&this._xTopLabel.hideAll(),this._xBottomLabel&&this._xBottomLabel.hideAll(),this._yCrosshair&&this._yCrosshair.hideAll(),this._yLeftLabel&&this._yLeftLabel.hideAll(),this._yRightLabel&&this._yRightLabel.hideAll()}layoutByValue(t=n8.ALL){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={height:0,leftPos:0,topPos:0,x:0,bottom:{visible:!1,text:"",dx:0,dy:0},top:{visible:!1,text:"",dx:0,dy:0},visible:!1},o={width:0,leftPos:0,topPos:0,y:0,left:{visible:!1,text:"",dx:0,dy:0},right:{visible:!1,text:"",dx:0,dy:0},visible:!1};const l=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))};let c=0,d=0;if(this.currValueX.size){const t=Array.from(this.currValueX.values())[0];c=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().x-this.getLayoutStartPoint().x}if(this.currValueY.size){const t=Array.from(this.currValueY.values())[0];d=t.axis.getScale().scale(t.v)+t.axis.getLayoutStartPoint().y-this.getLayoutStartPoint().y}a.visible=!!this.currValueX.size&&Number.isFinite(c),o.visible=!!this.currValueY.size&&Number.isFinite(d);const u={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},p={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};let g,f;if(l(u,this.currValueX),l(p,this.currValueY),this.xHair&&this.currValueX.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const o=t.getScale();if(hl(o.type)){const e=o._step;g=t?null===(n=(i=r.getXAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):e}else if(ol(o.type)){const t=r.fieldX[0],i=r.fieldX2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionX(n);i?(g=Math.abs(s-r.dataToPositionX1(n)),e=`${n[t]} ~ ${n[i]}`):g=1,c=s}}if(null===(s=this.xHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"bottom"===t.getOrient()?(a.bottom.visible=!0,a.bottom.text=e,a.bottom.dx=0,a.bottom.dy=i):"top"===t.getOrient()&&(a.top.visible=!0,a.top.text=e,a.top.dx=0,a.top.dy=-i)}})),this.yHair&&this.currValueY.forEach((({axis:t,v:e})=>{var i,n,s;e=null!=e?e:"";const a=t.getScale();if(hl(a.type)){const t=a._step;f=a?null===(n=(i=r.getYAxisHelper()).getBandwidth)||void 0===n?void 0:n.call(i,0):t}else if(ol(a.type)){const t=r.fieldY[0],i=r.fieldY2,n=R5(r.getViewData().latestData,+e,t,i);if(n){const s=r.dataToPositionY(n);i?(f=Math.abs(s-r.dataToPositionY1(n)),e=`${n[t]} ~ ${n[i]}`):f=1,d=s}}if(null===(s=this.yHair.label)||void 0===s?void 0:s.visible){const i=m1(t.getSpec());"left"===t.getOrient()?(o.left.visible=!0,o.left.text=e,o.left.dx=-i,o.left.dy=0):"right"===t.getOrient()&&(o.right.visible=!0,o.right.text=e,o.right.dx=i,o.right.dy=0)}})),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if(a.leftPos=u.x1,a.topPos=u.y1,a.height=u.y2-u.y1,a.x=c+this.getLayoutStartPoint().x,null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod){const{top:t,bottom:e}=a;e.visible&&(e.text=this.xHair.label.formatMethod(e.text,"bottom")),t.visible&&(t.text=this.xHair.label.formatMethod(t.text,"top"))}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if(o.leftPos=p.x1,o.topPos=p.y1,o.width=p.x2-p.x1,o.y=d+this.getLayoutStartPoint().y,null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod){const{left:t,right:e}=o;t.visible&&(t.text=this.yHair.label.formatMethod(t.text,"left")),e.visible&&(e.text=this.yHair.label.formatMethod(e.text,"right"))}t&&(n8.HORIZONTAL&&this._layoutHorizontal(o,null!=f?f:0),n8.VERTICAL&&this._layoutVertical(a,null!=g?g:0)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.xHair)return;const{x:l,topPos:h,height:c,top:d,bottom:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.xHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.xHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.xHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.xHair.style.size-e);const p=this.xHair.type;let g;if("line"===p?g={start:{x:l+e/2-t/2,y:h},end:{x:l+e/2+t/2,y:h+c}}:"rect"===p&&(g={start:{x:l-t/2,y:h},end:{x:l+e+t/2,y:h+c}}),this._updateCrosshair("x",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h},d),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.xHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+e/2,y:h+c},u),this.xHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.xHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e){var i,n,s,r,a,o;if(t._isCache&&this.enableRemain||!this.yHair)return;const{leftPos:l,width:h,y:c,left:d,right:u,visible:p}=t;if(p){let t=0;(null===(n=null===(i=this.yHair)||void 0===i?void 0:i.style)||void 0===n?void 0:n.sizePercent)?t=(this.yHair.style.sizePercent-1)*e:"number"==typeof(null===(r=null===(s=this.yHair)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size)&&(t=this.yHair.style.size-e);const p=this.yHair.type;let g;if("line"===p?g={start:{x:l,y:c+e/2},end:{x:l+h,y:c+e/2}}:"rect"===p&&(g={start:{x:l,y:c-t/2},end:{x:l+h,y:c+e+t/2}}),this._updateCrosshair("y",p,g),d.visible){const t=Object.assign(Object.assign(Object.assign({x:l,y:c+e/2},d),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(a=this.yHair.label)||void 0===a?void 0:a.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(u.visible){const t=Object.assign(Object.assign(Object.assign({x:l+h,y:c+e},u),this.yHair.label),{textStyle:Object.assign(Object.assign({},null===(o=this.yHair.label)||void 0===o?void 0:o.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._crosshairConfig;t&&t.visible&&(this.xHair=this._parseField(t,"xField")),e&&e.visible&&(this.yHair=this._parseField(e,"yField"))}_updateCrosshair(t,e,i){const n=this.getContainer();let s,r;"x"===t?(s=this._xCrosshair,r=this.xHair.style):(s=this._yCrosshair,r=this.yHair.style),s?s.setAttributes(i):("line"===e?s=new EU(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1})):"rect"===e&&(s=new PU(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex}))),null==n||n.add(s),"x"===t?this._xCrosshair=s:this._yCrosshair=s)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(i(t=new vU(e)),n.add(t)),P5(t,this._getLimitBounds())}clear(){[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}r8.type=bn.cartesianCrosshair,function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.NONE=0]="NONE"}(s8||(s8={}));class a8 extends i8{static createComponent(t,e){const i=t.crosshair||e.defaultSpec;if(l(i))return;if(!f(i))return i.categoryField||i.valueField?new a8(i,Object.assign(Object.assign({},e),{specKey:"crosshair"})):void 0;const n=[];return i.forEach(((t,i)=>{(t.categoryField||t.valueField)&&n.push(new a8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"crosshair"})))})),n}constructor(t,e){super(t,Object.assign({},e)),this.type=bn.polarCrosshair,this.name=bn.polarCrosshair,this.currValueX=new Map,this.currValueY=new Map}_showDefaultCrosshair(){this.showDefault}hide(){this._radiusCrosshair&&this._radiusCrosshair.hideAll(),this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll(),this._angleCrosshair&&this._angleCrosshair.hideAll(),this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}findAllAxisContains(t,e){const i=this._getAxisInfoByField("category"),n=this._getAxisInfoByField("value");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(n,t,e)}}getAllAxisValues(t,e,i){let n=!1;return t.forEach((t=>{hl(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const s=t.axis,{x:r,y:a}=t.axis.getLayoutStartPoint(),{x:o,y:l}=this.getLayoutStartPoint();let h=s.positionToData({x:e.x-(r-o),y:e.y-(a-l)});ol(s.getScale().type)&&_(+h)&&(h=(+h).toFixed(2));const c={x:s.getCenter().x+this.getLayoutStartPoint().x,y:s.getCenter().y+this.getLayoutStartPoint().y};i.set(n,{v:h,axis:t.axis,center:c,innerRadius:s.getInnerRadius(),radius:s.getOuterRadius(),startAngle:s.startAngle,endAngle:s.endAngle,distance:Ut.distancePP(e,s.getCenter()),coord:s.pointToCoord(e),point:e})})),!0)}_layoutCrosshair(t,e){const{xAxisMap:i,yAxisMap:n}=this.findAllAxisContains(t,e);if(0!==i.size||0!==n.size)this.currValueX.clear(),this.currValueY.clear(),i&&this.getAllAxisValues(i,{x:t,y:e},this.currValueX),n&&this.getAllAxisValues(n,{x:t,y:e},this.currValueY),this.layoutByValue(s8.ALL);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){var e,i,n,s;if(!this.enable)return;const r=this._firstSeries();if(!r)return;let a={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,label:{visible:!1,text:"",offset:0}},o={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:r.angleAxisHelper.getScale(0).ticks().length,label:{visible:!1,text:"",offset:0}};if(this.xHair){a.visible=!!this.currValueX.size;const t=r.angleAxisHelper.getBandwidth(0);this.currValueX.forEach((e=>{var i,{axis:n,v:s,coord:o}=e,l=vn(e,["axis","v","coord"]);s=null!=s?s:"",Lh(a,l);const h=r.angleAxisHelper.dataToPosition([s]);a.angle=h,(null===(i=this.xHair.label)||void 0===i?void 0:i.visible)&&(a.label.visible=!0,a.label.text=s,a.label.offset=m1(n.getSpec())),a.startAngle=h-t/2,a.endAngle=h+t/2}))}if(this.yHair&&(o.visible=!!this.currValueY.size,this.currValueY.forEach((t=>{var e,{axis:i,v:n,coord:s}=t,r=vn(t,["axis","v","coord"]);n=null!=n?n:"",(null===(e=this.yHair.label)||void 0===e?void 0:e.visible)&&(o.label.visible=!0,o.label.text=n,o.label.offset=m1(i.getSpec())),o.angle=s.angle,o.axis=i,Lh(o,r)}))),this.enableRemain&&!a.visible&&h(this._cacheXCrossHairInfo))a=this._cacheXCrossHairInfo;else if((null===(i=null===(e=this.xHair)||void 0===e?void 0:e.label)||void 0===i?void 0:i.formatMethod)&&a.label.visible){const{label:t}=a;t.text=this.xHair.label.formatMethod(t.text,"angle")}if(this.enableRemain&&!o.visible&&h(this._cacheYCrossHairInfo))o=this._cacheYCrossHairInfo;else if((null===(s=null===(n=this.yHair)||void 0===n?void 0:n.label)||void 0===s?void 0:s.formatMethod)&&o.label.visible){const{label:t}=o;t.text=this.yHair.label.formatMethod(t.text,"radius")}t&&(s8.HORIZONTAL&&this._layoutHorizontal(o),s8.VERTICAL&&this._layoutVertical(a)),this.enableRemain&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},a),{_isCache:!0}),this._cacheYCrossHairInfo=Object.assign(Object.assign({},o),{_isCache:!0}))}_layoutVertical(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:n,innerRadius:s,radius:r,label:a,startAngle:o,endAngle:l,center:h,visible:c}=t;if(c){const t="rect"===this.xHair.type?"sector":"line";let c;if(c="sector"===t?{center:h,innerRadius:s,radius:r,startAngle:o,endAngle:l}:{start:Qt(h,s,n),end:Qt(h,r,n)},this._angleCrosshair)this._angleCrosshair.setAttributes(c);else{let e;"line"===t?e=new EU(Object.assign(Object.assign({},c),{lineStyle:this.xHair.style,zIndex:this.gridZIndex})):"sector"===t&&(e=new OU(Object.assign(Object.assign({},c),{sectorStyle:this.xHair.style,zIndex:this.gridZIndex}))),this._angleCrosshair=e,i.add(e)}if(a.visible){const t=tl(n),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(h,r+a.offset,n)),this.xHair.label),a),{textStyle:Object.assign(Object.assign({},null===(e=this.xHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutHorizontal(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:n,endAngle:s,distance:r,sides:a,axis:o,label:l,point:h,radius:c,innerRadius:d,visible:u}=t,p=this.getContainer();if(u){const t=this.yHair.smooth?"circle":"polygon";let u=r;if("polygon"===t){const t=o.getCenter(),e=te(t,h),i=(s-n)/a,l=Math.floor((e-n)/i),p=l*i+n,g=Math.min((l+1)*i+n,s),f=Qt(t,r,p),v=Qt(t,r,g),m=Me([v.x,v.y],[f.x,f.y],[t.x,t.y],[h.x,h.y]);m&&(u=ut(Ut.distancePN(h,m[0],m[1])+r,d,c))}const g={center:i,startAngle:n,endAngle:s,radius:u,sides:a};if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(g);else{let e;e="polygon"===t?new BU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex+1})):new RU(Object.assign(Object.assign({},g),{lineStyle:this.yHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=e,p.add(e)}if(l.visible){const t=function(t){let e="center",i="middle";return e=(t=Yo(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}}(n),s=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,u,n)),this.yHair.label),l),{textStyle:Object.assign(Object.assign({},null===(e=this.yHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,s,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._crosshairConfig;e&&e.visible&&(this.xHair=this._parseField(e,"categoryField")),i&&i.visible&&(this.yHair=this._parseField(i,"valueField"),this.yHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const n=this.getContainer();t?t.setAttributes(e):(t=new vU(e),n.add(t),i(t)),P5(t,this._getLimitBounds())}clear(){[(this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair)].forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),super.clear()}}a8.type=bn.polarCrosshair;const o8=t=>ON(Object.assign({},t)),l8=t=>Object.assign(Object.assign({},t),{style:Object.assign({},ON(t.style))}),h8=t=>{var e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=o8(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=o8(null!==(s=null===(n=null==t?void 0:t.slider)||void 0===n?void 0:n.railStyle)&&void 0!==s?s:{}),m=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},ON(Object.assign({},y)));var y;const _=l8(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),b=l8(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),x=l8(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),S=l8(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{});return Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:t.orient,slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:m}),controller:Object.assign(Object.assign({},t.controller),{start:_,pause:b,backward:x,forward:S})})},c8=t=>"left"===t||"right"===t,d8=t=>"top"===t||"bottom"===t;class u8 extends D5{constructor(){super(...arguments),this.layoutZIndex=PK.Player,this.layoutLevel=RK.Player,this.type=bn.player,this.specKey="player",this._orient="bottom",this._getPlayerAttrs=()=>{var t,e;const i=this._spec.type,n={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"===i?Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"discrete"}))(this._spec,this._specs)),n):Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},h8(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),n)},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?z(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t)):("discrete"===t.type?this._playerComponent=new CX(t):this._playerComponent=new PX(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,n,s,r,a,o,l;return Math.max(...V(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...V(null===(n=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===n?void 0:n.size),...V(null===(r=null===(s=this._spec.controller.backward)||void 0===s?void 0:s.style)||void 0===r?void 0:r.size),...V(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,n,s,r,a,o,l;const h=null!==(t=c8(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...V(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...V(null===(s=null===(n=this._spec.controller.pause)||void 0===n?void 0:n.style)||void 0===s?void 0:s.size),...V(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...V(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.globalInstance.on(cK.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(SX.OnEnd,(()=>{var t;this.event.emit(cK.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(SX.OnChange,(t=>{const{index:e}=t.detail,i=this._specs[e];V(i.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(cK.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnBackward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnForward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPlay,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(SX.OnPause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(cK.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})}))}}get orient(){return this._orient}get layoutOrient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,n,s,r,a;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!==(n=this._spec.alternate)&&void 0!==n&&n,this._dx=null!==(s=this._spec.dx)&&void 0!==s?s: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"}setLayoutStartPosition(t){if(super.setLayoutStartPosition(t),_(t.x)){const e=c8(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(_(t.y)){const e=d8(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}boundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}clear(){var t;super.clear(),this._playerComponent&&(null===(t=this.getContainer())||void 0===t||t.removeChild(this._playerComponent)),this._playerComponent=null}_computeLayoutRect(t,e,i){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 y(this._spec.width)?Math.min(t.width,Number(this._spec.width)):c8(this._orient)?this._maxSize():t.width}_computeHeight(t){return y(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):d8(this._orient)?this._maxSize():t.height}_computeDx(t){return c8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return d8(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}}u8.type=bn.player,u8.createComponent=(t,e)=>{const i=t.player;return l(i)||!1===i.visible?null:new u8(i,e)};const p8=(t,e)=>Ko(t[0].latestData,e.field),g8=(t,e)=>qo(t[0].latestData,e.field);function f8(t,e){return Zo(t[0].latestData,e.field)}function v8(t,e){return Jo(t[0].latestData,e.field)}function m8(t,e){return Qo(t[0].latestData,e.field)}function y8(t,e){return function(t,e){return Math.sqrt(Qo(t,e))}(t[0].latestData,e.field)}function _8(t,e){return function(t,e){return J(t.map((t=>t[e])))}(t[0].latestData,e.field)}function b8(t,e){const i={min:p8,max:g8,sum:f8,average:v8,variance:m8,standardDeviation:y8,median:_8},n=[];return e.forEach((e=>{const s={x:null,y:null};if(h(e.x)){const n=e.x;if("string"==typeof n||"number"==typeof n)s.x=n;else{const{aggrType:e,field:r}=n;s.x=i[e](t,{field:r})}}if(h(e.y)){const n=e.y;if("string"==typeof n||"number"==typeof n)s.y=n;else{const{aggrType:e,field:r}=n;s.y=i[e](t,{field:r})}}e.getRefRelativeSeries&&(s.getRefRelativeSeries=e.getRefRelativeSeries),n.push(s)})),n}function x8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getXAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.x)){y(t.x)&&A8(u,t.x,s)&&(null===(i=null==n?void 0:(e=n.getXAxisHelper()).setExtendDomain)||void 0===i||i.call(e,"marker_xAxis_extend",t.x));const h=n.getXAxisHelper().dataToPosition([t.x])+a.x,d=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),p=Math.min(a.y,l.y);c.push([{x:h,y:d},{x:h,y:p}])}})),c}function S8(t,e,i,n,s){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.getRegion(),l=o.getLayoutStartPoint(),c=[],d=t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,u=n.getYAxisHelper().getScale(0).domain();return d.forEach((t=>{var e,i;if(h(t.y)){y(t.y)&&A8(u,t.y,s)&&(null===(i=null===(e=n.getYAxisHelper())||void 0===e?void 0:e.setExtendDomain)||void 0===i||i.call(e,"marker_yAxis_extend",t.y));const h=Math.min(a.x,l.x),d=n.getYAxisHelper().dataToPosition([t.y])+a.y,p=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);c.push([{x:h,y:d},{x:p,y:d}])}})),c}function w8(t,e,i){const n=[];return(t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var s,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.getRegion().getLayoutStartPoint(),c=l.getXAxisHelper().getScale(0).domain(),d=l.getYAxisHelper().getScale(0).domain();y(t.x)&&A8(c,t.x,i)&&(null===(r=null===(s=l.getXAxisHelper())||void 0===s?void 0:s.setExtendDomain)||void 0===r||r.call(s,"marker_xAxis_extend",t.x)),y(t.y)&&A8(d,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)),n.push({x:l.getXAxisHelper().dataToPosition([t.x])+h.x,y:l.getYAxisHelper().dataToPosition([t.y])+h.y})})),n}function A8(t,e,i){if(!i)return!1;const n=Math.min(...t),s=Math.max(...t);return es}const k8=["sum","average","min","max","variance","standardDeviation","median"];class M8 extends D5{constructor(){super(...arguments),this.layoutType="absolute"}created(){super.created(),this.initEvent(),this._bindSeries(),this._initDataView()}_isSpecAggrOrRege(t){return"regression"===t||k8.includes(t)}_processSpecX(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{x:{field:e.getSpec().xField,aggrType:i}}):{x:t}}_processSpecY(t){const e=this._relativeSeries;let i;return o(t)&&(t=t(this._relativeSeries.getData().getLatestData(),this._startRelativeSeries.getData().getLatestData(),this._endRelativeSeries.getData().getLatestData())),this._isSpecAggrOrRege(t)?(i=t,{y:{field:e.getSpec().yField,aggrType:i}}):{y:t}}_processSpecCoo(t){var e;return(null!==(e=t.coordinates)&&void 0!==e?e:V(t.coordinate)).map((t=>{const e=this._getSeriesByIdOrIndex(t.refRelativeSeriesId,t.refRelativeSeriesIndex),{xField:i,yField:n}=e.getSpec(),{[i]:s,[n]:r}=t,a={x:null,y:null};return this._isSpecAggrOrRege(s)?a.x={field:i,aggrType:s}:a.x=s,this._isSpecAggrOrRege(r)?a.y={field:n,aggrType:r}:a.y=r,a.getRefRelativeSeries=()=>e,a}))}updateLayoutAttribute(){var t;(null===(t=this._spec.visible)||void 0===t||t)&&(this._markerComponent||(this._createMarkerComponent(),this._markerComponent.on("*",((t,e)=>this._delegateEvent(this._markerComponent,t,e)))),this._markerLayout()),super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,n;let s;return s=null===(i=this._option.getSeriesInUserIdOrIndex(V(t),[e]))||void 0===i?void 0:i[0],s||(s=null!==(n=this._relativeSeries)&&void 0!==n?n:this.getFirstSeries()),s}_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)}_computeClipRange(t){let e=1/0,i=-1/0,n=1/0,s=-1/0;return t.forEach((t=>{t.getLayoutStartPoint().xi&&(i=t.getLayoutStartPoint().x+t.getLayoutRect().width),t.getLayoutStartPoint().ys&&(s=t.getLayoutStartPoint().y+t.getLayoutRect().height)})),{minX:e,maxX:i,minY:n,maxY:s}}initEvent(){}onRender(t){}changeRegions(t){}getFirstSeries(){for(let t=0;tt[e]),(t=>t[i])),s=Ko(t,e),r=qo(t,e),a=n(s),o=n(r);return[{[e]:s,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class T8 extends M8{constructor(){super(...arguments),this.type=bn.markLine,this.name=bn.markLine,this.layoutZIndex=PK.MarkLine}static createComponent(t,e){const i=t.markLine||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new T8(i,Object.assign(Object.assign({},e),{specKey:T8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new T8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:T8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_;const b=new GY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0},{x:0,y:0}],lineStyle:ON(null===(e=this._spec)||void 0===e?void 0:e.line.style),startSymbol:Object.assign(Object.assign({},null===(i=this._spec)||void 0===i?void 0:i.startSymbol),{visible:null===(n=this._spec.startSymbol)||void 0===n?void 0:n.visible,style:ON(null===(s=this._spec.startSymbol)||void 0===s?void 0:s.style)}),endSymbol:Object.assign(Object.assign({},null===(r=this._spec)||void 0===r?void 0:r.endSymbol),{visible:null===(a=this._spec.endSymbol)||void 0===a?void 0:a.visible,style:ON(null===(o=this._spec.endSymbol)||void 0===o?void 0:o.style)}),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.padding,shape:Object.assign(Object.assign({},ON(null===(c=this._spec.label)||void 0===c?void 0:c.shape)),{visible:null!==(p=null===(u=null===(d=this._spec.label)||void 0===d?void 0:d.shape)||void 0===u?void 0:u.visible)&&void 0!==p&&p}),panel:Object.assign(Object.assign({},ON(null===(g=this._spec.label)||void 0===g?void 0:g.labelBackground.style)),{visible:null===(m=null===(v=null===(f=this._spec.label)||void 0===f?void 0:f.labelBackground)||void 0===v?void 0:v.visible)||void 0===m||m}),textStyle:ON(null===(y=this._spec.label)||void 0===y?void 0:y.style)})});this._markerComponent=b,this._markerComponent.name="markLine",this._markerComponent.id=null!==(_=this._spec.id)&&void 0!==_?_:`markLine-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)||h(a.coordinates)&&h(a.process)&&h(a.process.x),p=h(a.y)||h(a.coordinates)&&h(a.process)&&h(a.process.y),g=h(a.coordinates)&&(!h(a.process)||"process"in a&&"xy"in a.process),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[];u?y=x8(o,l,c,d,v)[0]:p?y=S8(o,l,c,d,v)[0]:g?y=w8(o,d,v):f&&(y=a.positions);const _=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let b;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);b={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(_):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:b})}_initDataView(){const t=this._spec,e=this._relativeSeries,i="x"in t,n="y"in t,s="coordinates"in t;if(!i&&!n&&!s)return;let r,a,o=!1,l=!1;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?(r=[this._processSpecX(t.x)],a=e.getViewData(),o=!0):n?(r=[this._processSpecY(t.y)],a=e.getViewData(),o=!0):s&&(r=this._processSpecCoo(t),a=new go(this._option.dataSet).parse([e.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:r}),t.process&&"x"in t.process&&(r=[this._processSpecX(t.process.x)],o=!0),t.process&&"y"in t.process&&(r=[this._processSpecY(t.process.y)],o=!0),t.process&&"xy"in t.process&&(r={fieldX:e.getSpec().xField,fieldY:e.getSpec().yField},l=!0));const h=new go(this._option.dataSet);h.parse([a],{type:"dataview"}),o&&h.transform({type:"markerAggregation",options:r}),l&&h.transform({type:"markerRegression",options:r}),h.target.on("change",(()=>{this._markerLayout()})),this._markerData=h}}T8.type=bn.markLine,T8.speckey="markLine";class E8 extends M8{constructor(){super(...arguments),this.type=bn.markArea,this.name=bn.markArea,this.layoutZIndex=PK.MarkArea}static createComponent(t,e){const i=t.markArea||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new E8(i,Object.assign(Object.assign({},e),{specKey:E8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new E8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:E8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g;const f=new UY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,points:[{x:0,y:0}],areaStyle:ON(null===(e=this._spec.area)||void 0===e?void 0:e.style),label:Object.assign(Object.assign({},this._spec.label),{padding:null===(n=null===(i=this._spec.label)||void 0===i?void 0:i.labelBackground)||void 0===n?void 0:n.padding,shape:Object.assign(Object.assign({},ON(null===(s=this._spec.label)||void 0===s?void 0:s.shape)),{visible:null!==(o=null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.shape)||void 0===a?void 0:a.visible)&&void 0!==o&&o}),panel:Object.assign(Object.assign({},ON(null===(h=null===(l=this._spec.label)||void 0===l?void 0:l.labelBackground)||void 0===h?void 0:h.style)),{visible:null===(u=null===(d=null===(c=this._spec.label)||void 0===c?void 0:c.labelBackground)||void 0===d?void 0:d.visible)||void 0===u||u}),textStyle:ON(null===(p=this._spec.label)||void 0===p?void 0:p.style)})});this._markerComponent=f,this._markerComponent.name="markArea",this._markerComponent.id=null!==(g=this._spec.id)&&void 0!==g?g:`markArea-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r;const a=this._spec,o=this._markerData,l=this._startRelativeSeries,c=this._endRelativeSeries,d=this._relativeSeries,u=h(a.x)&&h(a.x1),p=h(a.y)&&h(a.y1),g=h(a.coordinates),f=h(a.positions),v=null!==(t=null==a?void 0:a.autoRange)&&void 0!==t&&t,m=null!==(e=null==a?void 0:a.clip)&&void 0!==e&&e;let y=[],_=[];u?(_=x8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):p?(_=S8(o,l,c,d,v),y=[..._[0],_[1][1],_[1][0]]):g?y=w8(o,d,v):f&&(y=a.positions);const b=o.latestData[0].latestData?o.latestData[0].latestData:o.latestData;let x;if(m){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([l.getRegion(),c.getRegion(),d.getRegion()]);x={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({points:y,label:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(b):null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.label)||void 0===r?void 0:r.text}),clipRange:x})}_initDataView(){const t=this._spec,e=this._relativeSeries,i=h(t.x)&&h(t.x1),n=h(t.y)&&h(t.y1),s=h(t.coordinates);if(!i&&!n&&!s)return null;let r;hq(this._option.dataSet,"markerAggregation",b8),hq(this._option.dataSet,"markerRegression",C8),i?r=[this._processSpecX(t.x),this._processSpecX(t.x1)]:n?r=[this._processSpecY(t.y),this._processSpecY(t.y1)]:s&&(r=this._processSpecCoo(t));const a=new go(this._option.dataSet);a.parse([e.getViewData()],{type:"dataview"}),a.transform({type:"markerAggregation",options:r}),a.target.on("change",(()=>{this._markerLayout()})),this._markerData=a}}E8.type=bn.markArea,E8.speckey="markArea";class P8 extends M8{constructor(){super(...arguments),this.type=bn.markPoint,this.name=bn.markPoint,this.layoutZIndex=PK.MarkPoint}static createComponent(t,e){const i=t.markPoint||e.defaultSpec;if(l(i))return;if(!f(i)&&!1!==i.visible)return new P8(i,Object.assign(Object.assign({},e),{specKey:P8.speckey}));const n=[];return i.forEach(((t,i)=>{!1!==t.visible&&n.push(new P8(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:P8.speckey})))})),n}_createMarkerComponent(){var t,e,i,n,s,r,a,o,l,h,c,d,u,p,g,f,v,m,y,_,b,x,S,w,A,k,M,C,T;const E=new YY({zIndex:this.layoutZIndex,interactive:null!==(t=this._spec.interactive)&&void 0!==t&&t,position:{x:0,y:0},itemLine:Object.assign({lineStyle:ON(null===(i=null===(e=this._spec.itemLine)||void 0===e?void 0:e.line)||void 0===i?void 0:i.style)},this._spec.itemLine),itemContent:Object.assign({symbolStyle:ON(null===(s=null===(n=this._spec.itemContent)||void 0===n?void 0:n.symbol)||void 0===s?void 0:s.style),imageStyle:null===(a=null===(r=this._spec.itemContent)||void 0===r?void 0:r.image)||void 0===a?void 0:a.style,textStyle:Object.assign(Object.assign({},null===(o=this._spec.itemContent)||void 0===o?void 0:o.text),{padding:null===(c=null===(h=null===(l=this._spec.itemContent)||void 0===l?void 0:l.text)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.padding,shape:Object.assign(Object.assign({},ON(null===(u=null===(d=this._spec.itemContent)||void 0===d?void 0:d.text)||void 0===u?void 0:u.shape)),{visible:null!==(v=null===(f=null===(g=null===(p=this._spec.itemContent)||void 0===p?void 0:p.text)||void 0===g?void 0:g.shape)||void 0===f?void 0:f.visible)&&void 0!==v&&v}),panel:Object.assign(Object.assign({},ON(null===(_=null===(y=null===(m=this._spec.itemContent)||void 0===m?void 0:m.text)||void 0===y?void 0:y.labelBackground)||void 0===_?void 0:_.style)),{visible:null===(w=null===(S=null===(x=null===(b=this._spec.itemContent)||void 0===b?void 0:b.text)||void 0===x?void 0:x.labelBackground)||void 0===S?void 0:S.visible)||void 0===w||w}),textStyle:ON(null===(k=null===(A=this._spec.itemContent)||void 0===A?void 0:A.text)||void 0===k?void 0:k.style)}),richTextStyle:null===(C=null===(M=this._spec.itemContent)||void 0===M?void 0:M.richText)||void 0===C?void 0:C.style},this._spec.itemContent)});this._markerComponent=E,this._markerComponent.name="markPoint",this._markerComponent.id=null!==(T=this._spec.id)&&void 0!==T?T:`markPoint-${this.id}`,this.getContainer().add(this._markerComponent)}_markerLayout(){var t,e,i,n,s,r,a,o,l,h;const c=this._spec,d=this._markerData,u=this._relativeSeries,p="coordinate"in c,g="position"in c,f=null!==(t=null==c?void 0:c.autoRange)&&void 0!==t&&t,v=null!==(e=null==c?void 0:c.clip)&&void 0!==e&&e;let m;p?m=w8(d,u,f)[0]:g&&(m=c.position);const y=d.latestData[0].latestData?d.latestData[0].latestData:d.latestData;let _;if(v){const{minX:t,maxX:e,minY:i,maxY:n}=this._computeClipRange([u.getRegion()]);_={x:t,y:i,width:e-t,height:n-i}}null===(i=this._markerComponent)||void 0===i||i.setAttributes({position:m,itemContent:Object.assign(Object.assign({},null===(n=this._markerComponent.attribute)||void 0===n?void 0:n.itemContent),{textStyle:Object.assign(Object.assign({},null===(r=null===(s=this._markerComponent.attribute)||void 0===s?void 0:s.itemContent)||void 0===r?void 0:r.textStyle),{text:(null===(a=this._spec.itemContent.text)||void 0===a?void 0:a.formatMethod)?this._spec.itemContent.text.formatMethod(y):null===(h=null===(l=null===(o=this._markerComponent.attribute)||void 0===o?void 0:o.itemContent)||void 0===l?void 0:l.textStyle)||void 0===h?void 0:h.text})}),clipRange:_})}_initDataView(){const t=this._spec,e=this._relativeSeries;if(!h(t.coordinate))return;hq(this._option.dataSet,"markerAggregation",b8);const i=this._processSpecCoo(t),n=new go(this._option.dataSet);n.parse([e.getViewData()],{type:"dataview"}),n.transform({type:"markerAggregation",options:i}),n.target.on("change",(()=>{this._markerLayout()})),this._markerData=n}}P8.type=bn.markPoint,P8.speckey="markPoint";const R8=(t,e,i)=>l(t)?t:o(t)?t(e,i):t,O8=(t,e,i)=>{if(l(t))return t;if(f(t)){const n=[];return t.forEach((t=>{if(o(t)){const s=t(e,i);h(s)&&n.push(s)}else n.push(t)})),n}return o(t)?t(e,i):t};const B8=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,I8="vchart-tooltip-container",D8=20,L8={key:"其他",value:"..."},F8={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}};class j8{}j8.dom=`${IN}_TOOLTIP_HANDLER_DOM`,j8.canvas=`${IN}_TOOLTIP_HANDLER_CANVAS`;const z8=(t,e,i)=>{const n=R8(e.key,t,i),s=R8(e.value,t,i),r=!1!==R8(e.visible,t,i)&&(h(n)||h(s)),a=R8(e.isKeyAdaptive,t,i),o=R8(e.shapeType,t,i),l=R8(e.shapeColor,t,i),c=R8(e.keyStyle,t,i),d=R8(e.valueStyle,t,i);return{key:n,value:s,visible:r,isKeyAdaptive:a,hasShape:e.hasShape,shapeType:o,shapeHollow:e.shapeHollow,shapeColor:l,keyStyle:c,valueStyle:d}},H8=(t,e,i)=>{var n,s;return null!==(s=null===(n=t.tooltipHelper)||void 0===n?void 0:n.getDefaultTooltipPattern(e,i))&&void 0!==s?s:null},N8=(t,e,i)=>{var n;let s={};if("mark"===t&&e)s=null!==(n=H8(e,"mark"))&&void 0!==n?n:{};else if("dimension"===t&&(null==i?void 0:i.length)){const t=[];i[0].data.forEach((e=>{const{series:n}=e,s=[Object.assign(Object.assign({},i[0]),{data:[e]})],r=H8(n,"dimension",s);r&&t.push(r)}));const e=[];t.forEach((({content:t})=>{o(t)?e.push(t):e.push(...V(t))})),s=Object.assign(Object.assign({},t[0]),{content:e})}return s},V8=(t,e,i)=>{var n,s;let r={};if("mark"===t&&e){const t=null!==(s=null===(n=e.tooltipHelper)||void 0===n?void 0:n.spec)&&void 0!==s?s:{};r=t.mark?R(t.mark):{}}else if("dimension"===t&&(null==i?void 0:i.length)){const t=W8(i).filter((t=>{var e;const i=null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec;return h(null==i?void 0:i.dimension)&&dQ(i).includes("dimension")})).map((t=>t.tooltipHelper.spec.dimension));if(t.length){let e=[];t.every((({content:t})=>l(t)))?e=void 0:t.forEach((({content:t})=>{l(t)||(o(t)?null==e||e.push(t):null==e||e.push(...V(t)))})),r=Object.assign(Object.assign({},t[0]),{content:e})}}return r},W8=ht((t=>t.reduce(((t,e)=>t.concat(e.data.map((t=>t.series)).filter(h))),[]))),G8=t=>{const e={};return t.forEach((t=>{var i;const n=null!==(i=t.seriesId)&&void 0!==i?i:0;e[n]||(e[n]=t)})),e},U8=(t,e,i,n)=>{var s,r;const a=null!==(r=null==i?void 0:i[null!==(s=null==t?void 0:t.seriesId)&&void 0!==s?s:0])&&void 0!==r?r:null==i?void 0:i[0],o={};return["hasShape","shapeType","shapeColor"].forEach((i=>{var s,r,l;const h=null!==(l=null!==(r=null!==(s=null==t?void 0:t[i])&&void 0!==s?s:null==e?void 0:e[i])&&void 0!==r?r:null==a?void 0:a[i])&&void 0!==l?l:null==n?void 0:n[i];void 0!==h&&(o[i]=h)})),o},Y8=(t,e)=>{let i;if(h(t))if(y(t))i=t;else if(o(t)){const n=t(e);y(n)&&(i=n)}return i},X8={fontFamily:hN,spacing:10,multiLine:!1,wordBreak:"break-word"};function $8(t={},e,i){var n,s;return Object.assign(Object.assign({},null!=i?i:X8),{fill:null!==(n=t.fill)&&void 0!==n?n:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(s=t.fontFamily)&&void 0!==s?s:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak})}const K8=(t,e)=>{var i;const n=wN(e);if(!e.multiLine){const{width:e,height:i}=n.fullMeasure(t);return{width:e,height:i,text:t}}let s=t.split("\n");s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))});return{width:t.width(),height:t.height(),text:s}}return{width:r,height:a,text:s}};var q8;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(q8||(q8={}));class Z8{get id(){return this._id}get env(){return this._env}constructor(t,e){this._visible=!0,this._id="",this._attributeCache=null,this.showTooltip=(t,e,i)=>{var n;let s=!!i.changePositionOnly;return i.changePositionOnly&&(null===(n=this._cacheActualTooltip)||void 0===n?void 0:n.activeType)===t||(s=!1,this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0),s&&this._cacheViewSpec&&this._cacheActualTooltip?this.changeTooltipPosition(s,this._cacheActualTooltip,this._cacheViewSpec,t,e,i):this.changeTooltip(!0,i,s,t,e)},this._changeTooltip=(t,e,i,n,s)=>{var r,a,c,d,u,p,g,f,v;if(!t){this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const t=this._component.getSpec();return t.handler?null!==(c=null===(a=(r=t.handler).hideTooltip)||void 0===a?void 0:a.call(r,e))&&void 0!==c?c:q8.success:(this._updateTooltip(!1,e),q8.success)}if(l(n)||l(s))return q8.failed;let m;if(i&&this._cacheViewSpec?m=this._cacheViewSpec:(m=((t,e,i,n)=>{var s,r,a,l,c,d,u;const p=Object.assign(Object.assign({},e),{activeType:t});if("mark"===t&&i){const t=null!==(r=null===(s=i.tooltipHelper)||void 0===s?void 0:s.spec)&&void 0!==r?r:{};if(h(t.visible)||h(t.activeType)?p.visible=dQ(t).includes("mark"):h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("mark"):p.visible=!0,p.handler=null!==(l=null!==(a=t.handler)&&void 0!==a?a:e.handler)&&void 0!==l?l:void 0,null===(c=p.handler)||void 0===c?void 0:c.showTooltip)return p}else if("dimension"===t&&(null==n?void 0:n.length)&&(W8(n).every((t=>{var e;return!dQ(null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec).includes("dimension")}))?p.visible=!1:h(e.visible)||h(e.activeType)?p.visible=dQ(e).includes("dimension"):p.visible=!0,p.handler=null!==(d=e.handler)&&void 0!==d?d:void 0,null===(u=p.handler)||void 0===u?void 0:u.showTooltip))return p;const g=N8(t,i,n),f=V8(t,i,n),v=Lh({},R(e[t]),f),m=g.title,y=U8(void 0,v,void 0,m);if(h(v.title))if(o(v.title)){const t=v.title;v.title=(e,i)=>{var n;const s=null!==(n=t(e,i))&&void 0!==n?n:{};return Object.assign(Object.assign({},y),s)}}else v.title=Object.assign(Object.assign(Object.assign({},g.title),y),v.title);else v.title=Object.assign(Object.assign({},g.title),y);const _=V(g.content);if(h(v.content)){const t=G8(_);if(o(v.content)){const e=v.content;v.content=(i,n)=>{var s;const r=[];return V(null!==(s=e(i,n))&&void 0!==s?s:[]).forEach((e=>{r.push(Object.assign(Object.assign({},U8(e,v,t)),e))})),r}}else{const e=[];V(v.content).forEach((i=>{e.push(Object.assign(Object.assign({},U8(i,v,t)),i))})),v.content=e}}else v.content=_.map((t=>Object.assign(Object.assign({},t),U8(void 0,v,void 0,t))));return p[t]=Object.assign(Object.assign(Object.assign({},g),v),{activeType:t}),p})(n,this._component.getSpec(),e.model,e.dimensionInfo),this._cacheViewSpec=m),!1===m.visible)return q8.failed;if(m.handler)return null!==(p=null===(u=(d=m.handler).showTooltip)||void 0===u?void 0:u.call(d,n,s,e))&&void 0!==p?p:q8.success;const y=m[n];if(!y)return q8.failed;let _;return i&&this._cacheActualTooltip?_=this._cacheActualTooltip:(_=this._getActualTooltipContent(y,s,e),y.updateTitle&&(_.title=y.updateTitle(_.title,s,e)),y.updateContent&&(_.content=y.updateContent(_.content,s,e))),l(null===(g=_.title)||void 0===g?void 0:g.key)&&l(null===(f=_.title)||void 0===f?void 0:f.value)&&!(null===(v=_.content)||void 0===v?void 0:v.length)?q8.failed:(this._cacheActualTooltip=_,this._changeTooltipPosition(!!i,_,m,n,s,e))},this._changeTooltipPosition=(t,e,i,n,s,r)=>{var a,o,l;const h=r.event;if(i.handler)return null!==(l=null===(o=(a=i.handler).showTooltip)||void 0===o?void 0:o.call(a,n,s,r))&&void 0!==l?l:q8.success;const c=i[n];if(!c)return q8.failed;const d=this._getActualTooltipPosition(e,O8(c.position,s,r),r,this._getParentElement(i),t);e.position=d,c.updatePosition&&(e.position=c.updatePosition(e.position,s,r));let u=!1!==(null==c?void 0:c.visible);return s&&"mouseout"!==h.type&&e.visible&&(e.title||e.content)||(u=!1),this._updateTooltip(u,Object.assign(Object.assign({},r),{changePositionOnly:t}),e),q8.success},this._getActualTooltipContent=(t,e,i)=>{const n=O8(t.visible,e,i);let s=null;s=((t,e,i)=>{var n,s,r,a,o;if(!e||"mouseout"===(null===(n=null==i?void 0:i.event)||void 0===n?void 0:n.type))return null;const h=O8(t.title,e,i),c=V(O8(t.content,e,i)),d={title:{value:null===(s=null==h?void 0:h.value)||void 0===s?void 0:s.toString(),hasShape:!1,shapeType:void 0,shapeHollow:void 0},content:[]},{maxLineCount:u=D8}=t,p=!1!==R8(null==h?void 0:h.visible,e,i);if(h&&p){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}(e);d.title={value:R8(null==h?void 0:h.value,t,i),valueStyle:R8(null==h?void 0:h.valueStyle,t,i),hasShape:h.hasShape,shapeHollow:h.shapeHollow}}else d.title={hasShape:!1,visible:!1};if("mark"===t.activeType)for(const t of null!=c?c:[]){const n=z8(null===(r=e[0])||void 0===r?void 0:r.datum[0],t,i);if(!1!==n.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},n),L8));break}if(!(d.content.lengthl(t.seriesId)||t.seriesId===n.id)))&&void 0!==o?o:[];for(const n of e){for(const e of t){const t=z8(n,e,i);if(!1!==t.visible){if(d.content.length===u-1){d.content.push(Object.assign(Object.assign({},t),L8));break}if(!(d.content.length=u)break}if(d.content.length>=u)break}if(d.content.length>=u)break}return d.title&&(d.content.length>0&&d.content[0].shapeType?(l(d.title.shapeType)&&(d.title.shapeType=d.content[0].shapeType),l(d.title.shapeColor)&&(d.title.shapeColor=d.content[0].shapeColor)):d.title.hasShape=!1),d})(t,e,i);return Object.assign(Object.assign({},s),{visible:!!h(s)&&!1!==n,activeType:t.activeType})},this._getActualTooltipPosition=(t,e,i,n,s)=>{var r,a,o,l,d,u;const p=i.event,{width:g=0,height:f=0}=null!==(r=this._getTooltipBoxSize(t,s))&&void 0!==r?r:{},{offsetX:v,offsetY:m}=this._option,y=this._component.getSpec(),b="canvas"===y.renderMode,x=null===(a=null==i?void 0:i.chart)||void 0===a?void 0:a.getCanvasRect(),S=null!==(o=null==x?void 0:x.width)&&void 0!==o?o:DN,w=null!==(l=null==x?void 0:x.height)&&void 0!==l?l:LN;let A,k,M,C,T,E,P=!1;if(c(e)){const{left:t,right:i,top:n,bottom:s}=e;A=Y8(t,p),k=Y8(n,p),M=Y8(i,p),C=Y8(s,p)}else if(h(e)&&"mark"===t.activeType){P=!0;const t=i.item,n=i.model,s=null==t?void 0:t.getBounds(),r=null==n?void 0:n.getLayoutStartPoint();if(s&&r){let{x1:t,y1:i,x2:n,y2:a}=s;switch(t+=r.x,n+=r.x,i+=r.y,a+=r.y,e){case NK.left:A=t-g-v,k=(i+a)/2-f/2;break;case NK.right:A=n+v,k=(i+a)/2-f/2;break;case NK.top:A=(t+n)/2-g/2,k=i-f-m;break;case NK.bottom:A=(t+n)/2-g/2,k=a+m;break;case NK.inside:A=(t+n)/2-g/2,k=(i+a)/2-f/2}}}const R={width:0,height:0},O=(t=0)=>({x:t,y:t});let B=O(),I=O(),D=1,L=1;if(wo(this._env)&&!y.confine){if(R.width=window.innerWidth,R.height=window.innerHeight,!b){I=null!==(d=null==n?void 0:n.getBoundingClientRect())&&void 0!==d?d:{x:1/0,y:1/0};const t=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,e=null==t?void 0:t.getBoundingClientRect();B={x:e.x-I.x,y:e.y-I.y},D=B8(t,e),L=B8(n,I)}}else R.width=S,R.height=w;const{canvasX:F,canvasY:j}=p;T=_(A)?A:_(M)?S-g-M:F+v,E=_(k)?k:_(C)?w-f-C:j+m,T*=D,E*=D,wo(this._env)&&(T+=B.x,E+=B.y),T/=L,E/=L;const{width:z,height:H}=R;return(T+g)*L+I.x>z&&(P?T=(z-I.x)/L-g:T-=2*v+g),(E+f)*L+I.y>H&&(P?E=(H-I.y)/L-f:E-=2*m+f),T*L+I.x<0&&(T=0-I.x/L),E*L+I.y<0&&(E=0-I.y/L),{x:T,y:E}},this._component=e,this._chartOption=e.getOption(),this._env=this._chartOption.mode,this._chartContainer=this._chartOption.globalInstance.getContainer(),this._compiler=e.getCompiler(),this._id=t,this._initFromSpec()}hideTooltip(t){return this.changeTooltip(!1,t)}release(){var t,e,i;this._cacheViewSpec=void 0,this._cacheActualTooltip=void 0;const n=null!==(t=this._component.getSpec())&&void 0!==t?t:{};n.handler?null===(i=(e=n.handler).release)||void 0===i||i.call(e):this._removeTooltip()}_throttle(t){const e=this._component.getSpec();let i;return i=y(e.throttleInterval)?e.throttleInterval:"html"===e.renderMode&&e.transitionDuration?50:10,mt(t,i)}_getDefaultOption(){var t,e;const{offset:i}=this._component.getSpec();return Object.assign(Object.assign({},F8),{offsetX:null!==(t=null==i?void 0:i.x)&&void 0!==t?t:F8.offsetX,offsetY:null!==(e=null==i?void 0:i.y)&&void 0!==e?e:F8.offsetY})}_getTooltipBoxSize(t,e){var i,n,s,r;return e&&!l(this._attributeCache)||(this._attributeCache=((t,e)=>{const{spaceRow:i,padding:n,title:s,shape:r,key:a,value:o}=e,l=Object.assign(Object.assign({},e),{title:{},content:[],titleStyle:{value:s,spaceRow:i},contentStyle:{shape:r,key:a,value:o,spaceRow:i},hasContentShape:!1,keyWidth:0,valueWidth:0});["key","value","shape"].forEach((t=>{delete l[t]}));const{title:c={},content:d=[]}=t;let u=0,p=n.top+n.bottom,g=0;const{visible:f=!0,value:v="",valueStyle:m,hasShape:y,shapeType:_="",shapeHollow:b,shapeColor:x}=c;if(l.title.visible=f,f){const t=Lh({},s,$8(m,void 0,{})),{text:e,width:i,height:n}=K8(v,t);if(l.title.value=Object.assign(Object.assign({width:i,height:n},t),{text:e}),u=i,g=n,y&&TR[_]){const t={symbolType:_};b?t.stroke=x:t.fill=x,l.title.shape=t,u+=r.size+r.spacing,g=Math.max(r.size,g)}l.title.width=u,l.title.height=g,p+=g}if(d.length){const t=d.filter((t=>(t.key||t.value)&&!1!==t.visible));if(t.length){f&&(p+=i);let e=!1;const n=[],s=[],c=[];l.content=t.map(((l,d)=>{const u={height:0,spaceRow:i};let g=0;const{hasShape:f,key:v,shapeColor:m,shapeHollow:y,shapeType:_="",value:b,isKeyAdaptive:x}=l;if(h(v)){const t=Lh({},a,$8(l.keyStyle,void 0,{})),{width:e,height:i,text:r}=K8(v,t);u.key=Object.assign(Object.assign({width:e,height:i},t),{text:r}),x?s.push(e):n.push(e),g=Math.max(g,i)}if(h(b)){const t=Lh({},o,$8(l.valueStyle,void 0,{})),{width:e,height:i,text:n}=K8(b,t);u.value=Object.assign(Object.assign({width:e,height:i},t),{text:n}),c.push(e),g=Math.max(g,i)}if(f&&TR[_]){e=!0;const t={visible:!0,symbolType:_};y?t.stroke=m:t.fill=m,g=Math.max(r.size,g),u.shape=t}else u.shape={visible:!1};return u.height=g,p+=g,dh(t)?f(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial";function Q8(t,e){var i,n,s,r,a,o,l,c,d,u;const{panel:{fill:p,shadow:g,shadowBlur:f,shadowColor:v,shadowOffsetX:m,shadowOffsetY:y,shadowSpread:_,cornerRadius:b,stroke:x,lineWidth:S=0},padding:w,key:A,value:k,title:M,shape:C,enterable:T,spaceRow:E,transitionDuration:P}=t,R=p,O=function(t,e){if(!t)return;const{size:i}=Lh({},e,t),n={};return n.width=J8(i),n}(C),B=t6(A),I=t6(k),D={panel:{width:J8((null!==(n=null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.width)&&void 0!==n?n:0)+2*S),minHeight:J8((null!==(r=null===(s=null==e?void 0:e.panel)||void 0===s?void 0:s.height)&&void 0!==r?r:0)+2*S),paddingBottom:J8(w.bottom),paddingLeft:J8(w.left),paddingRight:J8(w.right),paddingTop:J8(w.top),borderColor:x,borderWidth:J8(S),borderRadius:J8(b),backgroundColor:R?`${R}`:"transparent",boxShadow:g?`${m}px ${y}px ${f}px ${_}px ${v}`:"initial",pointerEvents:T?"auto":"none",transitionDuration:P?`${P}ms`:"initial",transitionProperty:P?"transform":"initial",transitionTimingFunction:P?"ease-out":"initial"},title:t6(Lh({},M,null===(a=null==e?void 0:e.title)||void 0===a?void 0:a.value)),content:{},shapeColumn:{common:O,items:[],width:J8(C.size),marginRight:J8(null!==(o=C.spacing)&&void 0!==o?o:8)},keyColumn:{common:B,items:null===(l=null==e?void 0:e.content)||void 0===l?void 0:l.map((({key:t})=>Object.assign(Object.assign(Object.assign({},B),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.keyWidth),marginRight:J8(null!==(c=A.spacing)&&void 0!==c?c:26)},valueColumn:{common:I,items:null===(d=null==e?void 0:e.content)||void 0===d?void 0:d.map((({value:t})=>Object.assign(Object.assign(Object.assign({},I),t6(t)),(null==t?void 0:t.multiLine)?{width:J8(Math.ceil(t.width))}:void 0))),width:J8(null==e?void 0:e.valueWidth),marginRight:J8(null!==(u=k.spacing)&&void 0!==u?u:0)},spaceRow:J8(E)};if(h(E)){const t=E/2;[D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((e=>{e.marginTop=J8(t),e.marginBottom=e.marginTop})),D.content.marginTop=J8(-t),D.content.marginBottom=D.content.marginTop}else[D.content,D.shapeColumn.common,D.keyColumn.common,D.valueColumn.common].forEach((t=>{t.marginTop="initial",t.marginBottom="initial"}));return D}function t6(t,e){if(!t)return;const{fontFamily:i,fontSize:n,fill:s,textAlign:r,lineHeight:a,fontWeight:o,multiLine:l,wordBreak:h,maxWidth:c}=Lh({},e,t),d={};return d.fontFamily=i,d.fontSize=J8(n),d.color=s,d.textAlign=r,d.lineHeight=J8(a),d.fontWeight=o,d.whiteSpace=l?"initial":"nowrap",d.wordBreak=h,d.maxWidth=J8(c),d}class e6{static isInstance(t){return!!t&&t.type===e6.type}setOption(t){this._option=t,Object.values(this.children).forEach((e=>e.setOption(t)))}getParentEl(){return e6.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=e6.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;Object.values(this.children).forEach((t=>t.release())),this.children={},this.product&&(null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product),this.product=null)}createElement(t,e,i,n){const s=null==So?void 0:So.createElement(t),r=this.getParentEl();if(!s||!r)return;e&&s.classList.add(...e),i&&Object.keys(i).forEach((t=>{s.style[t]=i[t]})),n&&(s.id=n);let a=this.childIndex;if(e6.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(s):r.insertBefore(s,r.children[a]),s}}e6.type="tooltipModel";const i6={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},n6={boxSizing:"border-box"},s6={display:"flex",whiteSpace:"nowrap"},r6={display:"flex",flexDirection:"column",justifyContent:"space-around",fontSize:"0"},a6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},o6={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},l6={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},h6={lineHeight:"normal"};class c6 extends e6{init(t,e,i){if(!this.product){const n=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=n}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t){var e,i,n,s,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.shapeType||!TR[t.shapeType])return"";const{shapeType:l,size:h,color:d,hollow:u=!1,marginTop:p="0px"}=t,f=TR[l].pathStr;let v="currentColor";if(!d||g(d)||u)return v=u?"none":null!==(e=d)&&void 0!==e?e:"currentColor",`\n \n \n \n `;if(c(d)){v="gradientColor";let t="";return"radial"===d.gradient?t=`\n \n ${(null!==(i=d.stops)&&void 0!==i?i:[]).map((t=>``))}\n \t\n `:"linear"===d.gradient&&(t=`\n \n ${(null!==(o=d.stops)&&void 0!==o?o:[]).map((t=>``))}\n \n `),`\n \n ${t}\n \n \n `}return""}(t);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class d6 extends e6{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}class u6 extends e6{constructor(t,e,i,n){super(t,e,n),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=K(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=K(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,n;const s=this._option.getTooltipStyle();super.setStyle(Lh({},r6,s.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];r.forEach(((t,e)=>{var i,n,r,o,l;let h={};if("key-box"===this.className){const{key:r,isKeyAdaptive:o}=t;h=Lh({},o?o6:a6,Object.assign(Object.assign({height:J8(a[e].height)},s.keyColumn.common),null===(i=s.keyColumn.items)||void 0===i?void 0:i[e]));g(r)&&""!==(null===(n=null==r?void 0:r.trim)||void 0===n?void 0:n.call(r))||y(r)||h.visibility?h.visibility="visible":h.visibility="hidden",this.children[e].setStyle(h)}else"value-box"===this.className?(h=Lh({},l6,Object.assign(Object.assign({height:J8(a[e].height)},s.valueColumn.common),null===(r=s.valueColumn.items)||void 0===r?void 0:r[e])),this.children[e].setStyle(h)):"shape-box"===this.className&&(h=Lh({},h6,Object.assign(Object.assign({height:J8(a[e].height)},s.shapeColumn.common),null===(o=s.shapeColumn.items)||void 0===o?void 0:o[e])),null===(l=this.children[e])||void 0===l||l.setStyle(h,this._getShapeSvgOption(t,e)))}))}setContent(){var t,e,i,n;const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],r=null!==(n=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==n?n:[];s.forEach(((t,e)=>{var i,n,s,a,o,l,h;let c;if("key-box"===this.className){const a=t.key;c=g(a)&&""!==(null===(i=null==a?void 0:a.trim)||void 0===i?void 0:i.call(a))||y(a)?a:"",null===(n=this.children[e])||void 0===n||n.setContent(c,null===(s=r[e].key)||void 0===s?void 0:s.multiLine)}else if("value-box"===this.className){const i=t.value;c=g(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||y(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=r[e].value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(t,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||n.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i,n,s,r,a;const o=this._option.getTooltipStyle(),l=Object.assign(Object.assign({},o.shapeColumn),null===(i=o.shapeColumn.items)||void 0===i?void 0:i[e]),h=Object.assign(Object.assign({},o.keyColumn),null===(n=o.keyColumn.items)||void 0===n?void 0:n[e]);return{hasShape:t.hasShape,shapeType:t.shapeType,size:l.width,color:t.shapeColor,hollow:t.shapeHollow,marginTop:`calc((${null!==(r=null!==(s=h.lineHeight)&&void 0!==s?s:h.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=l.width)&&void 0!==a?a:"8px"}) / 2)`}}}class p6 extends e6{init(){this.product||(this.product=this.createElement("div",["container-box"])),this.shapeBox||this._initShapeBox(),this.keyBox||this._initKeyBox(),this.valueBox||this._initValueBox()}_initShapeBox(){const t=new u6(this.product,this._option,"shape-box",0);t.init(),this.shapeBox=t,this.children[t.childIndex]=t}_initKeyBox(){const t=new u6(this.product,this._option,"key-box",1);t.init(),this.keyBox=t,this.children[t.childIndex]=t}_initValueBox(){const t=new u6(this.product,this._option,"value-box",2);t.init(),this.valueBox=t,this.children[t.childIndex]=t}setStyle(t){super.setStyle(Lh({},s6,t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class g6 extends e6{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{title:e}=t;(null==e?void 0:e.hasShape)&&(null==e?void 0:e.shapeType)?this.shape||this._initShape():this.shape&&this._releaseShape(),this.textSpan||this._initTextSpan()}_initShape(){const t=new c6(this.product,this._option,0);t.init(),this.shape=t,this.children[t.childIndex]=t}_releaseShape(){this.shape&&(this.shape.release(),delete this.children[this.shape.childIndex],this.shape=null)}_initTextSpan(){const t=new d6(this.product,this._option,1);t.init(),this.textSpan=t,this.children[t.childIndex]=t}setStyle(t){var e,i,n;const s=this._option.getTooltipStyle(),r=this._option.getTooltipActual(),{title:a}=r;super.setStyle(Lh({},i6,s.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=s.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==a?void 0:a.hasShape,shapeType:null==a?void 0:a.shapeType,size:null===(n=s.shapeColumn.common)||void 0===n?void 0:n.width,color:null==a?void 0:a.shapeColor,hollow:null==a?void 0:a.shapeHollow})}setContent(){var t,e,i,n,s;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),o=this._option.getTooltipAttributes(),{title:l}=a;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==l?void 0:l.hasShape,shapeType:null==l?void 0:l.shapeType,size:null===(e=r.shapeColumn.common)||void 0===e?void 0:e.width,color:null==l?void 0:l.shapeColor,hollow:null==l?void 0:l.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setContent(null==l?void 0:l.value,null===(s=null===(n=o.title)||void 0===n?void 0:n.value)||void 0===s?void 0:s.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}class f6 extends e6{constructor(t,e,i,n){super(t,e,0),this.title=null,this.content=null,this._classList=i,this._id=n}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&h(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:"99999999999999",fontFamily:"sans-serif",fontSize:"11px",borderRadius:"3px",borderStyle:"solid",lineHeight:"initial",background:"#fff",boxShadow:"2px 2px 4px rgba(0, 0, 0, 0.1)",maxWidth:"100wh",maxHeight:"100vh"},e);this.product=i}_initTitle(){const t=new g6(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new p6(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(Lh({},n6,t.panel)),Object.values(this.children).forEach(((e,i)=>{e.setStyle(i>0?{marginTop:t.spaceRow}:{marginTop:"0px"})}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class v6 extends Z8{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(t,e){super(t,e),this.type=j8.dom,this._tooltipContainer=null==So?void 0:So.body,this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(So&&e){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributeCache},[t.className],this.id)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e,i){var n;if(t&&this.model){e.changePositionOnly||(this._tooltipActual=i,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const{x:s=0,y:r=0}=null!==(n=i.position)&&void 0!==n?n:{},a=this.model.product;a&&(a.style.transform=`translate3d(${s}px, ${r}px, 0)`)}else this.setVisibility(t)}_initStyle(){this._domStyle=Q8(this._style,this._attributeCache)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}}class m6 extends Z8{constructor(t,e){var i;super(t,e),this.type=j8.canvas,this._tooltipCanvasId=null===(i=this._chartOption.modeParams)||void 0===i?void 0:i.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new jX({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributeCache=null}_updateTooltip(t,e,i){this._visible=t;const n=this._compiler.getStage();if(!n)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(n);const s=null==i?void 0:i.position;e.changePositionOnly?h(s)&&this._tooltipComponent.setAttributes(s):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributeCache),s)),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()}}class y6{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,n;return this.component.event.emit(cK.tooltipShow,Object.assign(Object.assign({},e),{tooltipData:t,activeType:this.activeType,tooltip:this.component})),(null===(i=this.component.tooltipHandler)||void 0===i?void 0:i.showTooltip)&&h(t)?null!==(n=this.component.tooltipHandler.showTooltip(this.activeType,t,e))&&void 0!==n?n:q8.success:q8.failed},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}_getDimensionInfo(t){var e,i,n;let s;const r=t.event.viewX,a=t.event.viewY,o=this.component.getChart(),l={x:r,y:a};if(s=[...null!==(e=ZK(o,l))&&void 0!==e?e:[],...null!==(i=eq(o,l))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=null!==(n=s.filter((t=>{var e;const i=t.axis;if(!hl(i.getScale().type))return!1;let n;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){n=e;break}if(h(n))break}return h(n)&&n.getDimensionField()[0]===n.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}))[0])&&void 0!==n?n:s[0];s=[t]}return s}}class _6 extends y6{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const n=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i});return this._showTooltipByHandler(t,n)}shouldHandleTooltip(t,e){var i,n;const{tooltipInfo:s}=e;if(l(s))return!1;const r=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null!==(n=null==r?void 0:r.activeType)&&void 0!==n?n:this.component.getSpec().activeType).includes("dimension")}getMouseEventData(t){var e;return{tooltipInfo:this._getDimensionInfo(t),ignore:[...null!==(e=this.component.getOption().getAllSeries())&&void 0!==e?e:[]].some((e=>{var i;const n=null===(i=e.tooltipHelper)||void 0===i?void 0:i.ignoreTriggerSet.dimension;return t.model&&(null==n?void 0:n.has(t.model))||t.mark&&(null==n?void 0:n.has(t.mark))}))}}}class b6 extends y6{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){const{datum:n,series:s,dimensionInfo:r}=t,a=[{datum:[n],series:s}],o=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(r),changePositionOnly:i});return this._showTooltipByHandler(a,o)}shouldHandleTooltip(t,e){var i;const{tooltipInfo:n}=e;if(l(n))return!1;const s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper;return!!(null==s?void 0:s.activeType.includes("mark"))}getMouseEventData(t){var e;let i,n;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,s=e.tooltipHelper,r=null==s?void 0:s.activeTriggerSet.mark,a=null==s?void 0:s.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.model))||(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e,dimensionInfo:this._getDimensionInfo(t)}:((null==a?void 0:a.has(t.model))||(null==a?void 0:a.has(t.mark)))&&(n=!0)}return{tooltipInfo:i,ignore:n}}}const x6=t=>h(t)&&!f(t),S6=t=>h(t)&&f(t);class w6 extends D5{constructor(){super(...arguments),this.type=bn.tooltip,this.name=bn.tooltip,this.layoutType="absolute",this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleMouseOut=t=>{var e,i;if(this._alwaysShow)return;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;const{clientX:n,clientY:s}=t.event;wo(this._option.mode)&&(this._isPointerInChart({x:n,y:s})||this._isPointerOnTooltip(t))||this._handleChartMouseOut(t)},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign({},t)),this._cacheInfo=void 0)},this._handleMouseMove=t=>{if(this.tooltipHandler||this._initHandler(),this._processor||this._initProcessor(),this._alwaysShow)return;if(this._isPointerOnTooltip(t))return;const e=this._getMouseEventData(t),{tooltipInfo:{dimension:i},ignore:{mark:n,dimension:s}}=e;let r=!1,a=!1;r=this._showTooltipByMouseEvent("mark",e,t),r||(a=this._showTooltipByMouseEvent("dimension",e,t)),r||a||function(t){return l(t.mark)&&l(t.model)&&l(t.datum)}(t)||(n&&x6(this._cacheInfo)?r=this._showTooltipByMouseEvent("mark",e,t,!0):s&&S6(this._cacheInfo)?a=this._showTooltipByMouseEvent("dimension",e,t,!0):h(i)&&(a=this._showTooltipByMouseEvent("dimension",e,t))),r||a&&!l(i)||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,n)=>{const s=this._processor[t];if(!s.shouldHandleTooltip(i,{tooltipInfo:e.tooltipInfo[t],ignore:e.ignore[t]}))return!1;let r;if(n)r=!s.showTooltip(this._cacheInfo,i,!0);else{const n=e.tooltipInfo[t],a=this._isSameAsCacheInfo(n);r=!s.showTooltip(n,i,a),r&&(this._cacheInfo=n)}r&&(this._isTooltipShown=!0);const a=this._option.globalInstance;return r&&pZ.globalConfig.uniqueTooltip&&pZ.hideTooltip(a.id),r},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this._processor).forEach((i=>{const{tooltipInfo:n,ignore:s}=this._processor[i].getMouseEventData(t);e.tooltipInfo[i]=n,e.ignore[i]=s})),e},this._hideTooltipByHandler=t=>{var e,i,n;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 q8.success;if(this.event.emit(cK.tooltipHide,Object.assign(Object.assign({},t),{tooltip:this})),null===(n=this.tooltipHandler)||void 0===n?void 0:n.hideTooltip){const e=this.tooltipHandler.hideTooltip(t);return e||(this._isTooltipShown=!1),e}return q8.failed}}static createComponent(t,e){const i=t.tooltip;if(!i)return null;if(!f(i))return new w6(i,Object.assign(Object.assign({},e),{specKey:"tooltip"}));const n=[];return i.forEach(((t,i)=>{n.push(new w6(t,Object.assign(Object.assign({},e),{specIndex:i,specKey:"tooltip"})))})),n}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;this.event.emit(cK.tooltipRelease,{tooltip:this}),super.release(),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}_initHandler(){var t,e,i;const n=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",s=this._option.globalInstance.getTooltipHandlerByUser();if(s)this.tooltipHandler=s;else{const t="canvas"===n?m6:v6,s=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${null!==(i=this._option.specIndex)&&void 0!==i?i:0}`;this.tooltipHandler=new t(s,this)}}_initProcessor(){this._processor={mark:new b6(this),dimension:new _6(this)}}_initEvent(){var t;const e=null!==(t=this._spec.trigger)&&void 0!==t?t:"hover",i=this._option.mode;"hover"===e?(this._mountEvent("pointermove",{level:uK.chart},this._handleMouseMove),(Ao(i)||ko(i))&&(this._mountEvent("pointerdown",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut)),this._mountEvent("pointerout",{level:uK.chart,source:"chart"},this._handleMouseOut),this._mountEvent("pointermove",{source:"window"},this._handleMouseOut)):"click"===e&&(this._mountEvent("pointertap",{level:uK.chart},this._handleMouseMove),this._mountEvent("pointerup",{source:"window"},this._handleMouseOut))}_initTheme(t){super._initTheme(t),this._spec.style=this._prepareSpecAfterMergingTheme(Lh({},this._theme,this._originalSpec.style))}_shouldMergeThemeToSpec(){return!1}reInit(t){var e,i;super.reInit(t),this.tooltipHandler?null===(i=(e=this.tooltipHandler).reInit)||void 0===i||i.call(e):this._initHandler()}setAttrFromSpec(){var t;super.setAttrFromSpec();const e=this._spec;this._spec=Object.assign(Object.assign({},e),{visible:!h(e.visible)||e.visible,activeType:dQ(e),renderMode:"html",trigger:h(e.trigger)?e.trigger:"hover",className:h(e.className)?e.className:"vchart-tooltip-element",enterable:!!h(e.enterable)&&e.enterable,transitionDuration:h(e.transitionDuration)?e.transitionDuration:150}),this._spec.triggerOff=h(e.triggerOff)?e.triggerOff:this._spec.trigger,h(e.renderMode)?this._spec.renderMode=e.renderMode:ko(this._option.mode)&&(this._spec.renderMode="canvas"),h(e.mark)&&(this._spec.mark=Object.assign(Object.assign({},R(e.mark)),{activeType:"mark"})),h(e.dimension)&&(this._spec.dimension=Object.assign(Object.assign({},R(e.dimension)),{activeType:"dimension"})),h(e.parentElement)?g(e.parentElement)?this._spec.parentElement=null===(t=globalThis.document)||void 0===t?void 0:t.getElementById(e.parentElement):this._spec.parentElement=e.parentElement:wo(this._option.mode)&&(this._spec.parentElement=null==So?void 0:So.body),h(e.confine)?this._spec.confine=e.confine:this._spec.confine="canvas"===this._spec.renderMode}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 n=cQ(t,e,this.tooltipHandler,this._option);return"none"!==n&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),n}hideTooltip(){const t={changePositionOnly:!1,item:void 0,datum:void 0,source:dK.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}_isSameAsCacheInfo(t){if(t===this._cacheInfo)return!0;if(l(this._cacheInfo)||l(t))return!1;if(S6(t)){if(x6(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>DK(t,e[i])))}if(S6(this._cacheInfo))return!1;const e=this._cacheInfo;return(null==t?void 0:t.datum)===e.datum&&(null==t?void 0:t.mark)===e.mark&&(null==t?void 0:t.series)===e.series}_isPointerInChart(t){const e=this._option.globalInstance;if(!e.getChart())return!1;const{x:i,y:n}=t,s=e.getCanvas(),{x:r,y:a,width:o,height:l}=s.getBoundingClientRect();return i>=r&&i<=r+o&&n>=a&&n<=a+l}_isPointerOnTooltip(t){var e,i;if(this._spec.enterable&&"html"===this._spec.renderMode){const{event:n}=t;let s;if(h(n.nativeEvent)){const t=n.nativeEvent;s=t.target,t.composedPath&&t.composedPath().length>0&&(s=t.composedPath()[0])}else s=n.target;const r=null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.getTooltipContainer)||void 0===i?void 0:i.call(e);if(h(r)&&h(s)&&function(t,e){let i=t.parentNode;for(;null!==i;){if(i===e)return!0;i=i.parentNode}return!1}(s,r))return!0}return!1}getVisible(){return!0===this._spec.visible}}function A6(t){const e=[{type:"position",position:e=>{var i,n;const{data:s}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==s?void 0:s[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}];return e}function k6(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}w6.type=bn.tooltip;const M6={rect:function(t){var e,i,n,s,r,a,o;const{series:l,baseMark:h}=t,c=null!==(e=h.getLabelSpec())&&void 0!==e?e:{},d=null!==(i=c.position)&&void 0!==i?i:"outside",u=null!==(n=l.direction)&&void 0!==n?n:"vertical",p="horizontal"===l.direction?null===(s=l.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(r=l.getYAxisHelper())||void 0===r?void 0:r.isInverse();let f,v=d;"inside"!==v&&(v=t=>{const{data:e}=t,i=l.getMeasureField()[0];if("outside"===d){const t={vertical:["top","bottom"],horizontal:["right","left"]},n=(null==e?void 0:e[i])>=0&&p||(null==e?void 0:e[i])<0&&!p?1:0;return t[u][n]}return"inside-bottom"===d?"horizontal"===l.direction?"inside-left":"inside-bottom":"inside-top"===d?"horizontal"===l.direction?"inside-right":"inside-top":d}),f=!1!==c.overlap&&{strategy:null!==(o=null===(a=c.overlap)||void 0===a?void 0:a.strategy)&&void 0!==o?o:A6(l)};let m=!1;return g(d)&&d.includes("inside")&&(m=!0),{position:v,overlap:f,smartInvert:m}},symbol:function(t){var e,i,n,s;const{series:r,baseMark:a}=t,o=null!==(e=a.getLabelSpec())&&void 0!==e?e:{},l="horizontal"===r.direction?"right":"top",h=null!==(i=o.position)&&void 0!==i?i:l;let c;return c=!1!==o.overlap&&{strategy:null!==(s=null===(n=o.overlap)||void 0===n?void 0:n.strategy)&&void 0!==s?s:k6(),avoidBaseMark:"center"!==h},{position:h,overlap:c}},arc:function(t){var e,i;const{series:n,baseMark:s}=t,r=null!==(e=s.getLabelSpec())&&void 0!==e?e:{},a=null!==(i=r.position)&&void 0!==i?i:"outside",o=a;let l;return l=r.smartInvert?r.smartInvert:g(a)&&a.includes("inside"),{position:o,smartInvert:l}}};function C6(t,e,i){const{labelMark:n,series:s}=t,r={text:e[s.getMeasureField()[0]],data:e},a=Object.keys(n.stateStyle.normal);for(const t of a){const s=n.getAttribute(t,e);r[t]=s,"text"===t&&i&&(r[t]=i(r[t],e))}return r}class T6 extends D5{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._regions=e.getRegionsInIndex([e.specIndex]),this.layoutBindRegionID=this._regions.map((t=>t.id))}_interactiveConfig(t){const{interactive:e}=t;if(!0!==e)return{hover:!1,select:!1};const i={hover:!1,select:!1,state:t.state},{hover:n,select:s}=this._option.getChart().getSpec();return!1===n&&!1===n.enable||(i.hover=!0),!1===s&&!1===s.enable||(i.select=!0),i}setLayoutStartPosition(){}updateSpec(t){const e=super.updateSpec(t);return e.reRender=!0,e.reMake=!0,e}onRender(t){}changeRegions(t){}}T6.type=bn.label;class E6 extends T6{constructor(t,e){super(t,e),this.type=bn.label,this.name=bn.label,this.layoutType="absolute",this.layoutZIndex=PK.Label,this._layoutRule=t.labelLayout||"series"}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let s=0;st.getMarksWithoutRoot())).flat();r.some((t=>{var e;return!0===(null===(e=t.getLabelSpec())||void 0===e?void 0:e.visible)}))&&n.push(new E6(t,Object.assign(Object.assign({},e),{specIndex:s,specKey:"label"})))}return n}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent()}initEvent(){this.event.on(cK.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(NV.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(NV.AFTER_MARK_RENDER_END,t)};this.event.on("afterElementEncode",(t=>{var e;const i=t.item;!1===this._option.getChart().getLayoutTag()&&(null===(e=i.context)||void 0===e?void 0:e.model)===this&&this._delegateLabelEvent(i.getGroupGraphicItem())}))}_delegateLabelEvent(t){const e=null==t?void 0:t.findAll((t=>"text"===t.type),!0).filter((t=>!t.__vchart_event));e&&e.length>0&&e.forEach((e=>{e.__vchart_event=!0,e.addEventListener("*",((i,n)=>this._delegateEvent(t,i,n,e,e.attribute.data)))}))}_initTextMark(){this._labelInfo||(this._labelInfo=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nl(this._regions,(t=>{var e,i;const n=t.getMarks(),s=t.getRegion();this._labelInfo.get(s)||this._labelInfo.set(s,[]);for(let r=0;r{if("region"===this._layoutRule){const i=this._createMark({type:Hh.component,name:`${e.getGroupMark().name}-label-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:t}))}else t.forEach((t=>{const i=this._createMark({type:Hh.component,name:`${t.labelMark.name}-component`},{componentType:"label",support3d:this._spec.support3d});i&&(this._marks.addMark(i),this._labelComponentMap.set(i,{region:e,labelInfo:[t]}))}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach((({region:t,labelInfo:e},i)=>{const n=e.map((t=>t.baseMark)),s=i.getProduct(),r=this._option.getAllComponents().filter((t=>"totalLabel"===t.type));s.target(n.map((t=>t.getProduct()))).configure({interactive:!1}).depend(r.map((t=>t.getMarks()[0].getProduct()))).labelStyle((t=>{var i,s,r,a;const o=t.context.markId,l=this._option.getChart().getMarkById(o);if(l){const t=null!==(i=M6[l.type])&&void 0!==i?i:M6.symbol,o=null!==(s=l.getLabelSpec())&&void 0!==s?s:{},h=this._interactiveConfig(o),c=L(o,["position","style","state"]),d=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.centerOffset)&&void 0!==a?a:0;return Lh({textStyle:Object.assign({pickable:!0===o.interactive},o.style),overlap:{avoidMarks:this._option.getAllComponents().filter((t=>"totalLabel"===t.type)).map((t=>t.getMarks()[0].getProductId()))}},t(e[n.findIndex((t=>t===l))]),Object.assign(Object.assign(Object.assign({},c),h),{centerOffset:d,pickable:!1}))}})).encode(((t,i)=>{var s;const r=i.mark.context.markId,a=this._option.getChart().getMarkById(r);return C6(e[n.findIndex((t=>t===a))],t,null===(s=a.getLabelSpec())||void 0===s?void 0:s.formatMethod)})).size((()=>t.getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._labelComponentMap.get(t).region.getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}E6.type=bn.label;class P6 extends T6{constructor(){super(...arguments),this.type=bn.totalLabel,this.name=bn.totalLabel,this.layoutType="absolute",this.layoutZIndex=PK.Label}static createComponent(t,e){const i=e.getAllRegions(),n=[];for(let t=0;t{var s,r;if(null===(r=null===(s=i.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===r?void 0:r.visible){const s=new P6(i.getSpec().totalLabel,Object.assign(Object.assign({},e),{specIndex:t,specKey:"totalLabel"}));s.series=i,n.push(s)}}))}return n}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}_initTextMark(){var t;if(null===(t=this.series.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=this.series.getMarksInType([Hh.rect,Hh.symbol])[0],e=this._createMark({type:Hh.text,name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}_initTextMarkStyle(){super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[kK]},"normal",yK.Default)}_initLabelComponent(){const t=this._createMark({type:Hh.component,name:`${this.series.name}-total-label-component`},{componentType:"label",support3d:this._spec.support3d});t&&this._marks.addMark(t)}updateLayoutAttribute(){super.updateLayoutAttribute(),this._marks.forEach(((t,e)=>{t.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{if(this._baseMark){const{offset:t,animation:e,overlap:i}=this._spec,n=this._interactiveConfig(this._spec);return Lh({textStyle:{pickable:!0===this._spec.interactive},position:R6(this.series,this._baseMark.type)},Object.assign({offset:t,animation:e,overlap:i,dataFilter:t=>t.filter((t=>t.data[CK]))},n))}})).encode(((t,e)=>C6({baseMark:this._baseMark,labelMark:this._textMark,series:this.series},t,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{var e;const i=this._regions[0].getGroupMark().getProduct();t.compile({group:i}),null===(e=t.getProduct())||void 0===e||e.configure({context:{model:this}})}))}}function R6(t,e){let i;if("rect"===e)i="horizontal"===t.direction?"right":"top";else i="top";return i}P6.type=bn.totalLabel;class O6{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,n;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!==(n=t.elements)&&void 0!==n?n:[]}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,n){t.forEach((t=>{t.index<0&&t.index>=i||(_(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:o(t.size)&&(e[t.index]={value:t.size(n),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;const n=t;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((t=>{if("modelId"in t&&h(t.modelId)){if(h(n.userId)&&n.userId===t.modelId)return!0}else if("modelKey"in t&&h(t.modelKey)&&"modelIndex"in t&&h(t.modelIndex)&&n.specKey===t.modelKey&&n.getSpecIndex()===t.modelIndex)return!0;return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGird(t,e){var i;const n="col"===e?this._colSize:this._rowSize;let s=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 n=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:n.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),n.forEach((t=>t.value=i/n.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 s=e.filter((t=>"normal"===t.layoutType)),r=s.filter((t=>B6(t))),a=s.filter((t=>!B6(t)));s.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>B6(t))),h=o.filter((t=>!B6(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 n,s;const r="rowGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGird.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(n=a(o,"col"))&&void 0!==n?n:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(s=r(o,"row"))&&void 0!==s?s:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);_(h.width)||(h.width=l.width),_(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function B6(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}class I6 extends IZ{layoutItems(t,e,i,n){this._chartLayoutRect=i,this._chartViewBox=n,this._leftCurrent=i.x,this._topCurrent=i.y,this._rightCurrent=i.x+i.width,this._bottomCurrent=i.height+i.y,e.sort(((t,e)=>e.layoutLevel-t.layoutLevel)),this.layoutNormalItems(e.filter((t=>"normal"===t.layoutType)));const s=this._leftCurrent,r=this._topCurrent,a=this._rightCurrent,o=this._bottomCurrent,l=e.filter((t=>"region"===t.layoutType)),h=e.filter((t=>"region-relative"===t.layoutType)),c=e.filter((t=>"absolute"===t.layoutType)),d=c.filter((t=>"z"===t.layoutOrient));let u={width:0,height:0};if(d.length){u=d[0].getLayoutRect()}this._leftCurrent+=u.width/8,this._rightCurrent-=u.width/8,this._topCurrent+=u.height/8,this._bottomCurrent-=u.height/8;if(this.layoutRegionItems(l,h,{offsetBottom:0,offsetTop:0,offsetLeft:0,offsetRight:0}),h.some((t=>t.getAutoIndent()))){const{top:t,bottom:e,left:i,right:n}=this._checkAutoIndent(h);(t||e||i||n)&&(this._topCurrent=r+t,this._bottomCurrent=o-e,this._leftCurrent=s+i,this._rightCurrent=a-n,this.layoutRegionItems(l,h))}const p=c.filter((t=>"z"!==t.layoutOrient));this.layoutAbsoluteItems(p);const g=h.filter((t=>t.specKey&&"axes"===t.specKey&&VK(t.layoutOrient)))[0],f=h.filter((t=>t.specKey&&"axes"===t.specKey&&WK(t.layoutOrient)))[0];if(g&&d.length){const t=g.getLayoutStartPoint(),e=g.getLayoutRect(),i={x:"left"===f.layoutOrient?t.x+e.width:t.x,y:t.y,width:this._chartLayoutRect.width,height:this._chartLayoutRect.height};d[0].directionStr="left"===f.layoutOrient?"r2l":"l2r";const n=g.getLayoutRect(),s=f.getLayoutRect(),r={length:d[0].getLayoutRect().width,width:n.width,height:s.height};g.setLayout3dBox&&g.setLayout3dBox(r),f.setLayout3dBox&&f.setLayout3dBox(r),d[0].setLayout3dBox&&d[0].setLayout3dBox(r),this.layoutZAxisItems(d,i)}}layoutZAxisItems(t,e){t.forEach((t=>{t.absoluteLayoutInRect(e)}))}layoutRegionItems(t,e,i){let n=this._rightCurrent-this._leftCurrent,s=this._bottomCurrent-this._topCurrent;i||(i={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0}),e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({width:n.width}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft+i.offsetLeft}),this._leftCurrent+=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetLeft):"right"===t.layoutOrient&&(this._rightCurrent-=n.width+t.layoutPaddingLeft+t.layoutPaddingRight+i.offsetRight,t.setLayoutStartPosition({x:this._rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft}))})),n=this._rightCurrent-this._leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{const e=this.getItemComputeLayoutRect(t,i),n=t.computeBoundsInRect(e);t.setLayoutRect({height:n.height}),"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop+i.offsetTop}),this._topCurrent+=n.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this._bottomCurrent-=n.height+t.layoutPaddingTop+t.layoutPaddingBottom+i.offsetBottom,t.setLayoutStartPosition({y:this._bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))})),s=this._bottomCurrent-this._topCurrent,t.forEach((t=>{t.setLayoutRect({width:n,height:s}),t.setLayoutStartPosition({x:this._leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this._topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),e.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})}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})}}))}getItemComputeLayoutRect(t,e){e||(e={offsetLeft:0,offsetRight:0,offsetTop:0,offsetBottom:0});return{width:this._rightCurrent-this._leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight-(e.offsetLeft+e.offsetRight),height:this._bottomCurrent-this._topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom-(e.offsetTop+e.offsetBottom)}}}var D6;D6={},D(xU.poptip,D6),SM.load(CU),pZ.useChart([zQ,I1,VQ,UQ,q2,Q1,r2,l2,E2,m2,H0,n3,R1,O1,c2,M5,T5,a1,h1,p2,k2,C2,o3,z0,p3,b3,JQ,W2,k1,x2,E1]),pZ.useComponent([T4,P4,R4,O4,B4,L4,D4,H4,X4,w6,r8,a8,H5,z5,K4,Q4,T8,q4,E8,u8,P6,E6,P8,V5,N5,J5]),BN.registerLayout("grid",O6),BN.registerLayout("layout3d",I6),t.Arc3dMark=a2,t.ArcMark=F0,t.AreaChart=zQ,t.AreaMark=TQ,t.AreaSeries=BQ,t.Bar3dChart=UQ,t.Bar3dSeries=GQ,t.BarChart=VQ,t.BarSeries=NQ,t.BaseChart=LQ,t.BaseMark=NZ,t.BaseSeries=wQ,t.BoxPlotChart=JQ,t.BoxPlotMark=qQ,t.BoxPlotSeries=ZQ,t.Brush=V5,t.CartesianAxis=w4,t.CartesianBandAxis=P4,t.CartesianChart=FQ,t.CartesianCrossHair=r8,t.CartesianLinearAxis=T4,t.CartesianLogAxis=O4,t.CartesianSeries=kQ,t.CartesianSymlogAxis=B4,t.CartesianTimeAxis=R4,t.CellMark=C1,t.CirclePackingChart=z0,t.CirclePackingSeries=j0,t.CircularProgressChart=c2,t.CircularProgressSeries=h2,t.CommonChart=H0,t.ComponentMark=WZ,t.ContinuousLegend=X4,t.CustomMark=N5,t.DataZoom=H5,t.DiscreteLegend=H4,t.DotSeries=i3,t.Factory=BN,t.Funnel3dChart=h1,t.Funnel3dSeries=l1,t.FunnelChart=a1,t.FunnelSeries=r1,t.GaugeChart=k1,t.GaugePointerSeries=p1,t.GaugeSeries=f1,t.GeoCoordinate=Q4,t.GridLayout=O6,t.GroupMark=VZ,t.HeatmapChart=E1,t.HeatmapSeries=T1,t.Histogram3dChart=O1,t.HistogramChart=R1,t.Indicator=K4,t.Label=E6,t.Layout=IZ,t.Layout3d=I6,t.LineChart=I1,t.LineMark=CQ,t.LineSeries=B1,t.LinearProgressChart=p2,t.LinearProgressSeries=u2,t.LinkPathMark=N2,t.LinkSeries=J2,t.MapChart=Q1,t.MapLabelComponent=J5,t.MapSeries=J1,t.MarkArea=E8,t.MarkLine=T8,t.MarkPoint=P8,t.PathMark=u1,t.Pie3dChart=l2,t.Pie3dSeries=o2,t.PieChart=r2,t.PieSeries=n2,t.Player=u8,t.PolarAxis=I4,t.PolarBandAxis=L4,t.PolarChart=w1,t.PolarCrossHair=a8,t.PolarLinearAxis=D4,t.PolarSeries=c1,t.PolygonMark=n1,t.ProgressArcMark=g1,t.ProgressLikeChart=A1,t.ProgressLikeSeries=d1,t.Pyramid3dMark=o1,t.RadarChart=m2,t.RadarSeries=f2,t.RangeAreaChart=x2,t.RangeAreaSeries=b2,t.RangeColumn3dChart=C2,t.RangeColumn3dSeries=M2,t.RangeColumnChart=k2,t.RangeColumnSeries=A2,t.Rect3dMark=WQ,t.RectMark=HQ,t.RoseChart=E2,t.RoseLikeChart=v2,t.RoseLikeSeries=g2,t.RoseSeries=T2,t.RuleMark=s1,t.SankeyChart=W2,t.SankeySeries=V2,t.ScatterChart=q2,t.ScatterSeries=K2,t.ScrollBar=z5,t.SequenceChart=n3,t.SunburstChart=o3,t.SunburstSeries=a3,t.SymbolMark=RQ,t.TextMark=EQ,t.ThemeManager=nZ,t.Title=q4,t.Tooltip=w6,t.TotalLabel=P6,t.TreemapChart=p3,t.TreemapSeries=u3,t.VChart=pZ,t.WaterfallChart=b3,t.WaterfallSeries=_3,t.WordCloud3dChart=T5,t.WordCloud3dSeries=C5,t.WordCloudChart=M5,t.WordCloudSeries=k5,t.default=pZ,t.version="1.3.3",Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-editor/package.json b/packages/vchart-editor/package.json index 43066d4b34..13daf3e13c 100644 --- a/packages/vchart-editor/package.json +++ b/packages/vchart-editor/package.json @@ -30,7 +30,7 @@ "test-watch": "DEBUG_MODE=1 jest --watch" }, "dependencies": { - "@visactor/vchart": "workspace:1.3.2", + "@visactor/vchart": "workspace:1.3.3", "@visactor/vutils": "~0.15.14", "@visactor/vdataset": "~0.15.14", "@visactor/vrender": "~0.14.8" diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index 852c593e89..268ea9c24d 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "1.3.2", + "version": "1.3.3", "description": "The VChart JSON schema file.", "sideEffects": false, "main": "vchart.json", diff --git a/packages/vchart-schema/vchart.json b/packages/vchart-schema/vchart.json index 1b4e95680e..5f82c4fabd 100644 --- a/packages/vchart-schema/vchart.json +++ b/packages/vchart-schema/vchart.json @@ -60145,7 +60145,7 @@ }, "Mapvoid>": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60153,14 +60153,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60168,14 +60168,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60183,14 +60183,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60198,14 +60198,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60213,14 +60213,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60228,14 +60228,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60243,14 +60243,14 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" }, "size": { @@ -60258,7 +60258,7 @@ } }, "required": [ - "__@toStringTag@11541", + "__@toStringTag@11527", "size" ], "type": "object" @@ -73591,34 +73591,34 @@ }, "Promise": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" } }, "required": [ - "__@toStringTag@11541" + "__@toStringTag@11527" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" } }, "required": [ - "__@toStringTag@11541" + "__@toStringTag@11527" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@11541": { + "__@toStringTag@11527": { "type": "string" } }, "required": [ - "__@toStringTag@11541" + "__@toStringTag@11527" ], "type": "object" }, @@ -84378,3 +84378,4 @@ } } } + diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 785c223b84..bacea160a7 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "1.3.3", + "tag": "@visactor/vchart_v1.3.3", + "date": "Mon, 18 Sep 2023 03:27:40 GMT", + "comments": { + "none": [ + { + "comment": "fix: fix the issue of player component updateSpec, fixed #967" + } + ] + } + }, { "version": "1.3.2", "tag": "@visactor/vchart_v1.3.2", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index 3b8b2c5a80..8ee3c9d26b 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @visactor/vchart -This log was last generated on Thu, 14 Sep 2023 12:36:21 GMT and should not be manually modified. +This log was last generated on Mon, 18 Sep 2023 03:27:40 GMT and should not be manually modified. + +## 1.3.3 +Mon, 18 Sep 2023 03:27:40 GMT + +### Updates + +- fix: fix the issue of player component updateSpec, fixed #967 ## 1.3.2 Thu, 14 Sep 2023 12:36:21 GMT @@ -40,7 +47,7 @@ Tue, 05 Sep 2023 11:24:47 GMT ### Patches -- fix: fix the issue of `seriesIndex` not work in discrete legend, see #732 +- fix: fix the issue of `seriesIndex` not work in discrete legend, see #732 ### Updates @@ -200,7 +207,7 @@ Thu, 10 Aug 2023 05:23:25 GMT - feat: dimension tooltip supports linear axis -- feat: filling full data to map mark data in #420 +- feat: filling full data to map mark data in #420 - feat(background): support background of chart & series - feat(onError): support configuration of onerror in chart instance initoption - feat: supplement sync methods in vchart instance @@ -374,11 +381,11 @@ Wed, 26 Jul 2023 03:18:52 GMT - fix(label): pickable shoule be false if label component is configured `interactive: false` - fix the layoutOffsetX|Y not work in normal items - fix: line mark has a different easing in update animation causes strange animation effect -- fix: `channel` config not work in animation +- fix: `channel` config not work in animation - No longer requires to hold down the Ctrl key for zoom interaction & fix zoomLimit bug - fix: default tooltip handler needs to adapt to the scale property - fix(vchart): export IRegionSpec from VChart -- fix(waterfall-position): fix the mistake of compute totalPosition in waterfall-series +- fix(waterfall-position): fix the mistake of compute totalPosition in waterfall-series - fix: compact window variable for non-browser env - fix: compact window variable for non-browser env diff --git a/packages/vchart/package.json b/packages/vchart/package.json index 2557ededf0..2b4e759a0a 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.3.2", + "version": "1.3.3", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index f8c1feb27e..3f8f62419d 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -56,7 +56,7 @@ "vite": "3.2.6" }, "dependencies": { - "@visactor/vchart": "workspace:1.3.2", + "@visactor/vchart": "workspace:1.3.3", "@visactor/vrender": "~0.14.8", "@visactor/vutils": "~0.15.14" }